From e9c3eca68a99e520843561074bc4fe8bc02a7af5 Mon Sep 17 00:00:00 2001 From: clsty Date: Wed, 29 Oct 2025 17:44:32 +0800 Subject: [PATCH] Update 3.files.sh about warning_rsync() --- sdata/subcmd-install/3.files.sh | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/sdata/subcmd-install/3.files.sh b/sdata/subcmd-install/3.files.sh index 2c3f989ba..71c04e163 100644 --- a/sdata/subcmd-install/3.files.sh +++ b/sdata/subcmd-install/3.files.sh @@ -6,9 +6,15 @@ printf "${STY_CYAN}[$0]: 3. Copying config files\n${STY_RST}" # TODO: https://github.com/end-4/dots-hyprland/issues/2137 -function warning_rsync(){ +function warning_rsync_delete(){ printf "${STY_YELLOW}" - printf "The commands using rsync will overwrite the destination when it exists already.\n" + printf "The command below uses --delete for rsync which overwrites the destination folder.\n" + printf "${STY_RST}" +} + +function warning_rsync_normal(){ + printf "${STY_YELLOW}" + printf "The command below uses rsync which overwrites the destination.\n" printf "${STY_RST}" } @@ -85,7 +91,7 @@ showfun auto_get_git_submodule v auto_get_git_submodule # In case some dirs does not exists -v mkdir -p $XDG_BIN_HOME $XDG_CACHE_HOME $XDG_CONFIG_HOME $XDG_DATA_HOME +v mkdir -p $XDG_BIN_HOME $XDG_CACHE_HOME $XDG_CONFIG_HOME $XDG_DATA_HOME/icons if [[ ! "${SKIP_BACKUP}" == true ]]; then case $ask in @@ -111,11 +117,11 @@ case $SKIP_MISCCONF in for i in $(find dots/.config/ -mindepth 1 -maxdepth 1 ! -name 'quickshell' ! -name 'fish' ! -name 'hypr' ! -name 'fontconfig' -exec basename {} \;); do # i="dots/.config/$i" echo "[$0]: Found target: dots/.config/$i" - if [ -d "dots/.config/$i" ];then warning_rsync; v rsync -av --delete "dots/.config/$i/" "$XDG_CONFIG_HOME/$i/" - elif [ -f "dots/.config/$i" ];then warning_rsync; v rsync -av "dots/.config/$i" "$XDG_CONFIG_HOME/$i" + if [ -d "dots/.config/$i" ];then warning_rsync_delete; v rsync -av --delete "dots/.config/$i/" "$XDG_CONFIG_HOME/$i/" + elif [ -f "dots/.config/$i" ];then warning_rsync_normal; v rsync -av "dots/.config/$i" "$XDG_CONFIG_HOME/$i" fi done - warning_rsync; v rsync -av "dots/.local/share/konsole/" "${XDG_DATA_HOME:-$HOME/.local/share}"/konsole/ + warning_rsync_delete; v rsync -av "dots/.local/share/konsole/" "${XDG_DATA_HOME:-$HOME/.local/share}"/konsole/ ;; esac @@ -123,14 +129,14 @@ case $SKIP_QUICKSHELL in true) sleep 0;; *) # Should overwriting the whole directory not only ~/.config/quickshell/ii/ cuz https://github.com/end-4/dots-hyprland/issues/2294#issuecomment-3448671064 - warning_rsync; v rsync -av --delete dots/.config/quickshell/ "$XDG_CONFIG_HOME"/quickshell/ + warning_rsync_delete; v rsync -av --delete dots/.config/quickshell/ "$XDG_CONFIG_HOME"/quickshell/ ;; esac case $SKIP_FISH in true) sleep 0;; *) - warning_rsync; v rsync -av --delete dots/.config/fish/ "$XDG_CONFIG_HOME"/fish/ + warning_rsync_delete; v rsync -av --delete dots/.config/fish/ "$XDG_CONFIG_HOME"/fish/ ;; esac @@ -138,8 +144,8 @@ case $SKIP_FONTCONFIG in true) sleep 0;; *) case "$II_FONTSET_NAME" in - "") warning_rsync; v rsync -av --delete dots/.config/fontconfig/ "$XDG_CONFIG_HOME"/fontconfig/ ;; - *) warning_rsync; v rsync -av --delete dots-extra/fontsets/$II_FONTSET_NAME/ "$XDG_CONFIG_HOME"/fontconfig/ ;; + "") warning_rsync_delete; v rsync -av --delete dots/.config/fontconfig/ "$XDG_CONFIG_HOME"/fontconfig/ ;; + *) warning_rsync_delete; v rsync -av --delete dots-extra/fontsets/$II_FONTSET_NAME/ "$XDG_CONFIG_HOME"/fontconfig/ ;; esac;; esac @@ -152,7 +158,7 @@ arg_excludes+=(--exclude '/hyprland.conf') case $SKIP_HYPRLAND in true) sleep 0;; *) - warning_rsync; v rsync -av --delete "${arg_excludes[@]}" dots/.config/hypr/ "$XDG_CONFIG_HOME"/hypr/ + warning_rsync_delete; v rsync -av --delete "${arg_excludes[@]}" dots/.config/hypr/ "$XDG_CONFIG_HOME"/hypr/ t="$XDG_CONFIG_HOME/hypr/hyprland.conf" if [ -f $t ];then echo -e "${STY_BLUE}[$0]: \"$t\" already exists.${STY_RST}" @@ -189,7 +195,7 @@ case $SKIP_HYPRLAND in echo -e "${STY_BLUE}[$0]: \"$t\" already exists, will not do anything.${STY_RST}" else echo -e "${STY_YELLOW}[$0]: \"$t\" does not exist yet.${STY_RST}" - warning_rsync; v rsync -av --delete dots/.config/hypr/custom/ $t/ + v rsync -av --delete dots/.config/hypr/custom/ $t/ fi ;; esac @@ -199,7 +205,7 @@ declare -a arg_excludes=() # some foldes (eg. .local/bin) should be processed separately to avoid `--delete' for rsync, # since the files here come from different places, not only about one program. # v rsync -av "dots/.local/bin/" "$XDG_BIN_HOME" # No longer needed since scripts are no longer in ~/.local/bin -warning_rsync; v rsync -av "dots/.local/share/icons/" "${XDG_DATA_HOME:-$HOME/.local/share}"/icons/ +v cp -f "dots/.local/share/icons/illogical-impulse.svg" "${XDG_DATA_HOME}"/icons/illogical-impulse.svg # Prevent hyprland from not fully loaded sleep 1