forked from Shinonome/dots-hyprland
Use install_dir__skip_ifexist() for hypr/custom/ (#3201)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user