Update 3.files.sh about warning_rsync()

This commit is contained in:
clsty
2025-10-29 17:44:32 +08:00
parent 41a328fbf0
commit e9c3eca68a
+19 -13
View File
@@ -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 # TODO: https://github.com/end-4/dots-hyprland/issues/2137
function warning_rsync(){ function warning_rsync_delete(){
printf "${STY_YELLOW}" 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}" printf "${STY_RST}"
} }
@@ -85,7 +91,7 @@ showfun auto_get_git_submodule
v auto_get_git_submodule v auto_get_git_submodule
# In case some dirs does not exists # 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 if [[ ! "${SKIP_BACKUP}" == true ]]; then
case $ask in 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 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" # i="dots/.config/$i"
echo "[$0]: Found target: 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/" 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; v rsync -av "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 fi
done 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 esac
@@ -123,14 +129,14 @@ case $SKIP_QUICKSHELL in
true) sleep 0;; 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 # 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 esac
case $SKIP_FISH in case $SKIP_FISH in
true) sleep 0;; 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 esac
@@ -138,8 +144,8 @@ case $SKIP_FONTCONFIG in
true) sleep 0;; true) sleep 0;;
*) *)
case "$II_FONTSET_NAME" in case "$II_FONTSET_NAME" in
"") warning_rsync; v rsync -av --delete dots/.config/fontconfig/ "$XDG_CONFIG_HOME"/fontconfig/ ;; "") warning_rsync_delete; 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-extra/fontsets/$II_FONTSET_NAME/ "$XDG_CONFIG_HOME"/fontconfig/ ;;
esac;; esac;;
esac esac
@@ -152,7 +158,7 @@ arg_excludes+=(--exclude '/hyprland.conf')
case $SKIP_HYPRLAND in case $SKIP_HYPRLAND in
true) sleep 0;; 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" t="$XDG_CONFIG_HOME/hypr/hyprland.conf"
if [ -f $t ];then if [ -f $t ];then
echo -e "${STY_BLUE}[$0]: \"$t\" already exists.${STY_RST}" 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}" echo -e "${STY_BLUE}[$0]: \"$t\" already exists, will not do anything.${STY_RST}"
else else
echo -e "${STY_YELLOW}[$0]: \"$t\" does not exist yet.${STY_RST}" 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 fi
;; ;;
esac esac
@@ -199,7 +205,7 @@ declare -a arg_excludes=()
# some foldes (eg. .local/bin) should be processed separately to avoid `--delete' for rsync, # 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. # 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 # 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 # Prevent hyprland from not fully loaded
sleep 1 sleep 1