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
+19 -1
View File
@@ -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