fixed dotfiles path resolution to be inside this dir

This commit is contained in:
Acid
2025-11-11 21:18:06 -05:00
parent d6df47a532
commit 30fcdc256e
2 changed files with 35 additions and 28 deletions
+8 -8
View File
@@ -45,7 +45,7 @@ git clone https://github.com/acidburnmonkey/rice-cook.git && cd rice-cook
chmod +x preinstall.sh && sudo ./preinstall.sh
```
### Now move `rice-cook.py` & data.conf into dofiles directory and run it:
### copy dotfiles directory into this project
```
sudo uv run rice-cook.py
@@ -54,12 +54,12 @@ sudo uv run rice-cook.py
Should look like this .
```
|-dotfiles
|---nvim
|---ranger
|---etc...
|---data.conf
|---rice-cook.py
|-rice-cook.py
|-data.conf
|---dotfiles
|-----nvim
|-----ranger
|-----etc...
```
### Before reboot
@@ -70,7 +70,7 @@ Need to correct ownership of home directory
sudo chown -R user:user /home/username
```
## A snapshot of your current fedora config can be genereted with this script
## A snapshot of your current fedora config can be generated with this script
[link](https://github.com/acidburnmonkey/scripts/blob/main/fedora-apps.py)
+27 -20
View File
@@ -55,12 +55,16 @@ def main():
# This should not need sudo
# Pass D or L to copy_dotfiles function
while True:
console.print('Set up dotfiles for Desktop (D) or Laptop (L) ?', style='rule')
setup = input('>').lower()
if setup == 'l' or setup == 'd':
copy_dotfiles(setup)
break
if os.path.exists('dotfiles'):
while True:
console.print('Set up dotfiles for Desktop (D) or Laptop (L) ?', style='rule')
setup = input('>').lower()
if setup == 'l' or setup == 'd':
copy_dotfiles(setup)
break
else:
console.print('Dotfiles not found skipping...', style='error')
executable_scripts()
systemd()
@@ -263,11 +267,8 @@ def copy_dotfiles(setup):
console.rule("Copying Dotfiles", style='checked')
# list of relevant configs
lis = os.listdir()
lis = os.listdir('dotfiles')
exceptions = [
'.git',
'.bashrc',
'.zshrc',
'retired',
'data.conf',
'wrappedhl',
@@ -275,22 +276,23 @@ def copy_dotfiles(setup):
'install.sh',
'logg.log',
'README.md',
'.gitignore',
'rice-cook.py',
'Laptop-configs',
'.ideavimrc',
]
for z in exceptions:
if z in lis:
lis.remove(z)
# filter out .
lis = [item for item in lis if not item.startswith('.')]
destination = os.path.join(home, '.config')
shutil.copy2('.zshrc', home)
shutil.copy2('.p10k.zsh', home)
shutil.copy2('.vimrc', home)
shutil.copy2('.ideavimrc', home)
shutil.copy2('dotfiles/.zshrc', home)
shutil.copy2('dotfiles/.p10k.zsh', home)
shutil.copy2('dotfiles/.vimrc', home)
shutil.copy2('dotfiles/.ideavimrc', home)
if setup == 'l':
console.print("Setting up dotfiles for Laptop", style='ok')
@@ -301,12 +303,17 @@ def copy_dotfiles(setup):
elif setup == 'd':
console.print("Setting up dotfiles for Desktop", style='ok')
# copying files recursively
for dir in lis:
print(subprocess.run(f'cp -r {dir} {destination}', shell=True))
source = os.path.join('dotfiles', dir)
dest = os.path.join(destination, dir)
console.print("Dotfiles copied :heavy_check_mark:", style='ok')
logger.info('Dotfiles copied')
try:
print(shutil.copytree(source, dest, dirs_exist_ok=True))
except NotADirectoryError:
shutil.copy2(source, dest)
console.print("Dotfiles copied :heavy_check_mark:", style='ok')
logger.info('Dotfiles copied')
def executable_scripts():