Use install_dir__skip_ifexist() for hypr/custom/ (#3201)

This commit is contained in:
clsty
2026-04-08 14:59:31 +08:00
parent ada4b856f6
commit 771cc18be5
2 changed files with 20 additions and 2 deletions
+1 -1
View File
@@ -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" 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 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 esac
+19 -1
View File
@@ -57,6 +57,13 @@ rsync_dir(){
x mkdir -p "$(dirname ${INSTALLED_LISTFILE})" 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 -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(){ rsync_dir__sync(){
# NOTE: This function is only for using in other functions # NOTE: This function is only for using in other functions
# `--delete' for rsync to make sure that # `--delete' for rsync to make sure that
@@ -129,7 +136,7 @@ function install_dir__sync(){
fi fi
v rsync_dir__sync $s $t 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 # NOTE: Do not add prefix `v` or `x` when using this function
local s=$1 local s=$1
local t=$2 local t=$2
@@ -140,6 +147,17 @@ function install_dir__skip_existed(){
v rsync_dir $s $t v rsync_dir $s $t
fi 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(){ function install_dir__sync_exclude(){
# NOTE: Do not add prefix `v` or `x` when using this function # NOTE: Do not add prefix `v` or `x` when using this function
# Sync directory with exclude patterns # Sync directory with exclude patterns