Advertisement
lswest

dotfiles-update

Feb 9th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.02 KB | None | 0 0
  1. #!/bin/bash
  2. myHome=$HOME
  3. files[1]="$myHome/.config/compton.conf";
  4. files[2]="$myHome/.config/awesome/";
  5. files[3]="$myHome/.config/fontconfig/conf.d/00-earnestly.conf";
  6. files[4]="$myHome/.bashrc";
  7. files[5]="$myHome/.gitconfig";
  8. files[6]='/etc/pacman.conf';
  9. files[7]='/etc/X11/xorg.conf.d/';
  10. files[8]="$myHome/.i3/";
  11. files[9]="$myHome/.weechat-info";
  12.  
  13. cdCmd="cd $myHome/Repositories/dotfiles/"
  14.  
  15. pkglist="pacman -Qqen > pkglist.txt"
  16.  
  17. curDate=$(date +%d-%b-%H_%M)
  18.  
  19. gitCommands="git add .; git commit -m '$curDate'; git push;"
  20.  
  21.  
  22. for file in "${files[@]}"; do
  23.     if [[ $file == *"etc"* ]]; then
  24.         noPath=${file#*/};
  25.     else
  26.         noPath=${file#$myHome}
  27.     fi
  28.     if [[ $file == *"/" ]]; then
  29.         mkdir -p "$myHome/Repositories/dotfiles/${noPath}";
  30.         rsync -rl --exclude=".git" "$file"* "$myHome/Repositories/dotfiles/${noPath}";
  31.     else
  32.         rsync -rl --exclude=".git" "$file" "$myHome/Repositories/dotfiles/${noPath}";
  33.     fi
  34. done
  35.  
  36. eval $cdCmd
  37.  
  38. eval "$pkglist"
  39.  
  40. eval "${gitCommands}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement