From 771cc18be51b58ebc317807610d94f76af54b28f Mon Sep 17 00:00:00 2001 From: clsty Date: Wed, 8 Apr 2026 14:59:31 +0800 Subject: [PATCH] Use install_dir__skip_ifexist() for hypr/custom/ (#3201) --- sdata/subcmd-install/3.files-legacy.sh | 2 +- sdata/subcmd-install/3.files.sh | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/sdata/subcmd-install/3.files-legacy.sh b/sdata/subcmd-install/3.files-legacy.sh index 0cdd5fa92..866089dc4 100644 --- a/sdata/subcmd-install/3.files-legacy.sh +++ b/sdata/subcmd-install/3.files-legacy.sh @@ -68,7 +68,7 @@ case "${SKIP_HYPRLAND}" in v bash -c "printf \"# For fedora to setup polkit\nexec-once = /usr/libexec/kf6/polkit-kde-authentication-agent-1\n\" >> ${XDG_CONFIG_HOME}/hypr/hyprland/execs.conf" fi - install_dir__skip_existed "dots/.config/hypr/custom" "${XDG_CONFIG_HOME}/hypr/custom" + install_dir__ignore_existing "dots/.config/hypr/custom" "${XDG_CONFIG_HOME}/hypr/custom" ;; esac diff --git a/sdata/subcmd-install/3.files.sh b/sdata/subcmd-install/3.files.sh index 956ee4859..c043ec1b8 100644 --- a/sdata/subcmd-install/3.files.sh +++ b/sdata/subcmd-install/3.files.sh @@ -57,6 +57,13 @@ rsync_dir(){ x mkdir -p "$(dirname ${INSTALLED_LISTFILE})" rsync -a --out-format='%i %n' "$1"/ "$2"/ | awk -v d="$dest" '$1 ~ /^>/{ sub(/^[^ ]+ /,""); printf d "/" $0 "\n" }' >> "${INSTALLED_LISTFILE}" } +rsync_dir__ignore_existing(){ + # NOTE: This function is only for using in other functions + x mkdir -p "$2" + local dest="$(realpath -se $2)" + x mkdir -p "$(dirname ${INSTALLED_LISTFILE})" + rsync -a --ignore-existing --out-format='%i %n' "$1"/ "$2"/ | awk -v d="$dest" '$1 ~ /^>/{ sub(/^[^ ]+ /,""); printf d "/" $0 "\n" }' >> "${INSTALLED_LISTFILE}" +} rsync_dir__sync(){ # NOTE: This function is only for using in other functions # `--delete' for rsync to make sure that @@ -129,7 +136,7 @@ function install_dir__sync(){ fi v rsync_dir__sync $s $t } -function install_dir__skip_existed(){ +function install_dir__skip_ifexist(){ # NOTE: Do not add prefix `v` or `x` when using this function local s=$1 local t=$2 @@ -140,6 +147,17 @@ function install_dir__skip_existed(){ v rsync_dir $s $t fi } +function install_dir__ignore_existing(){ + # NOTE: Do not add prefix `v` or `x` when using this function + local s=$1 + local t=$2 + if [ -d $t ];then + 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}" + v rsync_dir__ignore_existing $s $t + fi +} function install_dir__sync_exclude(){ # NOTE: Do not add prefix `v` or `x` when using this function # Sync directory with exclude patterns