diff options
| author | JaKooLit <ejhay.games@gmail.com> | 2025-01-01 15:28:28 +0900 |
|---|---|---|
| committer | JaKooLit <ejhay.games@gmail.com> | 2025-01-01 15:28:28 +0900 |
| commit | d3446edfdecc7dbf3cfe1ccd7ba8cbbe30d07f9a (patch) | |
| tree | b33fc425db9f8fb089ee4aca6c46249e00ff9e54 /copy.sh | |
| parent | 307d2845e53477e2cd1cd266167d2065c2568f67 (diff) | |
updated copy.sh to offer Some User Scripts
Diffstat (limited to 'copy.sh')
| -rwxr-xr-x | copy.sh | 58 |
1 files changed, 53 insertions, 5 deletions
@@ -501,7 +501,12 @@ done printf "\n" -# restoration of old configs +# Restoring UserConfigs and UserScripts +echo -e "Restoring previous User-Configs... \n" +echo -e "${NOTE}: If you decide to restore the old configs, make sure to handle the updates or changes manually.\n" +echo -e "Visit and check KooL's Hyprland-Dots GitHub page for the commits.\n" + +# UserConfigs DIRH="hypr" FILES_TO_RESTORE=( "ENVariables.conf" @@ -519,18 +524,25 @@ FILES_TO_RESTORE=( DIRPATH=~/.config/"$DIRH" BACKUP_DIR=$(get_backup_dirname) +if [ -z "$BACKUP_DIR" ]; then + echo "${ERROR} - Backup directory name is empty. Exiting." + exit 1 +fi # Check if the UserConfigs directory exists in ~/.config/hypr if [ -d "$DIRPATH/UserConfigs" ]; then - # Loop through files to check and offer restoration for FILE_NAME in "${FILES_TO_RESTORE[@]}"; do BACKUP_FILE="$DIRPATH-backup-$BACKUP_DIR/UserConfigs/$FILE_NAME" - + if [ -f "$BACKUP_FILE" ]; then printf "\n${INFO} Found ${YELLOW}$FILE_NAME${RESET} in hypr backup...\n" read -p "${CAT} Do you want to restore ${ORANGE}$FILE_NAME${RESET} from backup? (y/N): " file_restore if [[ "$file_restore" == [Yy]* ]]; then - cp "$BACKUP_FILE" "$DIRPATH/UserConfigs/$FILE_NAME" && echo "${OK} - $FILE_NAME restored!" 2>&1 | tee -a "$LOG" + if cp "$BACKUP_FILE" "$DIRPATH/UserConfigs/$FILE_NAME"; then + echo "${OK} - $FILE_NAME restored!" 2>&1 | tee -a "$LOG" + else + echo "${ERROR} - Failed to restore $FILE_NAME!" 2>&1 | tee -a "$LOG" + fi else echo "${NOTE} - Skipped restoring $FILE_NAME." fi @@ -542,7 +554,43 @@ fi printf "\n%.0s" {1..2} -# copying Wallpapers +# UserScripts +echo -e "Restoring previous some User-Scripts...\n" + +DIRSH="hypr" +SCRIPTS_TO_RESTORE=( + "RofiBeats.sh" + "Weather.py" + "Weather.sh" +) + +DIRSHPATH=~/.config/"$DIRSH" + +if [ -d "$DIRSHPATH/UserScripts" ]; then + for SCRIPT_NAME in "${SCRIPTS_TO_RESTORE[@]}"; do + BACKUP_SCRIPT="$DIRSHPATH-backup-$BACKUP_DIR/UserScripts/$SCRIPT_NAME" + + if [ -f "$BACKUP_SCRIPT" ]; then + printf "\n${INFO} Found ${YELLOW}$SCRIPT_NAME${RESET} in hypr backup...\n" + read -p "${CAT} Do you want to restore ${ORANGE}$SCRIPT_NAME${RESET} from backup? (y/N): " script_restore + if [[ "$script_restore" == [Yy]* ]]; then + if cp "$BACKUP_SCRIPT" "$DIRPATH/UserScripts/$SCRIPT_NAME"; then + echo "${OK} - $SCRIPT_NAME restored!" 2>&1 | tee -a "$LOG" + else + echo "${ERROR} - Failed to restore $SCRIPT_NAME!" 2>&1 | tee -a "$LOG" + fi + else + echo "${NOTE} - Skipped restoring $SCRIPT_NAME." + fi + fi + done +else + echo "${ERROR} - UserScripts directory does not exist in $DIRPATH. Skipping restoration." +fi + +printf "\n%.0s" {1..2} + +# 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" |
