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 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 sudo uv run rice-cook.py
@@ -54,12 +54,12 @@ sudo uv run rice-cook.py
Should look like this . Should look like this .
``` ```
|-dotfiles |-rice-cook.py
|---nvim |-data.conf
|---ranger |---dotfiles
|---etc... |-----nvim
|---data.conf |-----ranger
|---rice-cook.py |-----etc...
``` ```
### Before reboot ### Before reboot
@@ -70,7 +70,7 @@ Need to correct ownership of home directory
sudo chown -R user:user /home/username 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) [link](https://github.com/acidburnmonkey/scripts/blob/main/fedora-apps.py)
+19 -12
View File
@@ -55,12 +55,16 @@ def main():
# This should not need sudo # This should not need sudo
# Pass D or L to copy_dotfiles function # Pass D or L to copy_dotfiles function
if os.path.exists('dotfiles'):
while True: while True:
console.print('Set up dotfiles for Desktop (D) or Laptop (L) ?', style='rule') console.print('Set up dotfiles for Desktop (D) or Laptop (L) ?', style='rule')
setup = input('>').lower() setup = input('>').lower()
if setup == 'l' or setup == 'd': if setup == 'l' or setup == 'd':
copy_dotfiles(setup) copy_dotfiles(setup)
break break
else:
console.print('Dotfiles not found skipping...', style='error')
executable_scripts() executable_scripts()
systemd() systemd()
@@ -263,11 +267,8 @@ def copy_dotfiles(setup):
console.rule("Copying Dotfiles", style='checked') console.rule("Copying Dotfiles", style='checked')
# list of relevant configs # list of relevant configs
lis = os.listdir() lis = os.listdir('dotfiles')
exceptions = [ exceptions = [
'.git',
'.bashrc',
'.zshrc',
'retired', 'retired',
'data.conf', 'data.conf',
'wrappedhl', 'wrappedhl',
@@ -275,22 +276,23 @@ def copy_dotfiles(setup):
'install.sh', 'install.sh',
'logg.log', 'logg.log',
'README.md', 'README.md',
'.gitignore',
'rice-cook.py', 'rice-cook.py',
'Laptop-configs', 'Laptop-configs',
'.ideavimrc',
] ]
for z in exceptions: for z in exceptions:
if z in lis: if z in lis:
lis.remove(z) lis.remove(z)
# filter out .
lis = [item for item in lis if not item.startswith('.')]
destination = os.path.join(home, '.config') destination = os.path.join(home, '.config')
shutil.copy2('.zshrc', home) shutil.copy2('dotfiles/.zshrc', home)
shutil.copy2('.p10k.zsh', home) shutil.copy2('dotfiles/.p10k.zsh', home)
shutil.copy2('.vimrc', home) shutil.copy2('dotfiles/.vimrc', home)
shutil.copy2('.ideavimrc', home) shutil.copy2('dotfiles/.ideavimrc', home)
if setup == 'l': if setup == 'l':
console.print("Setting up dotfiles for Laptop", style='ok') console.print("Setting up dotfiles for Laptop", style='ok')
@@ -301,9 +303,14 @@ def copy_dotfiles(setup):
elif setup == 'd': elif setup == 'd':
console.print("Setting up dotfiles for Desktop", style='ok') console.print("Setting up dotfiles for Desktop", style='ok')
# copying files recursively
for dir in lis: 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)
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') console.print("Dotfiles copied :heavy_check_mark:", style='ok')
logger.info('Dotfiles copied') logger.info('Dotfiles copied')