diff options
| author | Ja.KooLit <85185940+JaKooLit@users.noreply.github.com> | 2024-09-19 12:00:16 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-19 12:00:16 +0900 |
| commit | 4fe21c27c6433888561df7596f882c1dff97533f (patch) | |
| tree | c8f35393363f7f2de7ae6b5572c5f8bfe3fa4ec1 /copy.sh | |
| parent | 453ba552c03d982aa3649892160ff44244ca27e2 (diff) | |
| parent | 90794ab39de7b8acdcd8191231c3852f72498f9b (diff) | |
Merge pull request #451 from JaKooLit/main
main to development
Diffstat (limited to 'copy.sh')
| -rwxr-xr-x | copy.sh | 109 |
1 files changed, 64 insertions, 45 deletions
@@ -333,8 +333,6 @@ printf "\n" # Copy Config Files # set -e # Exit immediately if a command exits with a non-zero status. -printf "${NOTE} - Copying dotfiles first part\n" - # Function to create a unique backup directory name with month, day, hours, and minutes get_backup_dirname() { local timestamp @@ -342,51 +340,17 @@ get_backup_dirname() { echo "back-up_${timestamp}" } -# Check if the config directory exists -if [ ! -d "config" ]; then - echo "${ERROR} - The 'config' directory does not exist." - exit 1 -fi - -for DIR in btop cava hypr Kvantum qt5ct qt6ct swappy wallust wlogout; do - DIRPATH=~/.config/"$DIR" - - # Backup the existing directory if it exists - if [ -d "$DIRPATH" ]; then - echo -e "${NOTE} - Config for $DIR found, attempting to back up." - BACKUP_DIR=$(get_backup_dirname) - - # Backup the existing directory - mv "$DIRPATH" "$DIRPATH-backup-$BACKUP_DIR" 2>&1 | tee -a "$LOG" - if [ $? -eq 0 ]; then - echo -e "${NOTE} - Backed up $DIR to $DIRPATH-backup-$BACKUP_DIR." - else - echo "${ERROR} - Failed to back up $DIR." - exit 1 - fi - fi - - # Copy the new config - if [ -d "config/$DIR" ]; then - cp -r "config/$DIR" ~/.config/"$DIR" 2>&1 | tee -a "$LOG" - if [ $? -eq 0 ]; then - echo "${OK} - Copy of config for $DIR completed!" - else - echo "${ERROR} - Failed to copy $DIR." - exit 1 - fi - else - echo "${ERROR} - Directory config/$DIR does not exist to copy." - exit 1 - fi -done - -printf "\n" - -printf "${NOTE} - copying dotfiles second part\n" +printf "${NOTE} - copying dotfiles first part\n" # Config directories which will ask the user whether to replace or not -DIRS="ags fastfetch kitty nvim rofi swaync waybar" +DIRS=" + ags + fastfetch + kitty + rofi + swaync + waybar +" for DIR2 in $DIRS; do DIRPATH=~/.config/"$DIR2" @@ -439,6 +403,61 @@ done printf "\n%.0s" {1..1} +printf "${NOTE} - Copying dotfiles second part\n" + +# Check if the config directory exists +if [ ! -d "config" ]; then + echo "${ERROR} - The 'config' directory does not exist." + exit 1 +fi + +DIR=" + btop + cava + hypr + Kvantum + qt5ct + qt6ct + swappy + wallust + wlogout +" + +for DIR_NAME in $DIR; do + DIRPATH=~/.config/"$DIR_NAME" + + # Backup the existing directory if it exists + if [ -d "$DIRPATH" ]; then + echo -e "${NOTE} - Config for $DIR_NAME found, attempting to back up." + BACKUP_DIR=$(get_backup_dirname) + + # Backup the existing directory + mv "$DIRPATH" "$DIRPATH-backup-$BACKUP_DIR" 2>&1 | tee -a "$LOG" + if [ $? -eq 0 ]; then + echo -e "${NOTE} - Backed up $DIR_NAME to $DIRPATH-backup-$BACKUP_DIR." + else + echo "${ERROR} - Failed to back up $DIR_NAME." + exit 1 + fi + fi + + # Copy the new config + if [ -d "config/$DIR_NAME" ]; then + cp -r "config/$DIR_NAME" ~/.config/"$DIR_NAME" 2>&1 | tee -a "$LOG" + if [ $? -eq 0 ]; then + echo "${OK} - Copy of config for $DIR_NAME completed!" + else + echo "${ERROR} - Failed to copy $DIR_NAME." + exit 1 + fi + else + echo "${ERROR} - Directory config/$DIR_NAME does not exist to copy." + exit 1 + fi +done + +printf "\n" + # copying Wallpapers mkdir -p ~/Pictures/wallpapers cp -r wallpapers ~/Pictures/ && { echo "${OK} some wallpapers compied!"; } || { echo "${ERROR} Failed to copy some wallpapers."; exit 1; } 2>&1 | tee -a "$LOG" |
