From 82ba870e5778319e690117f277361818546c93aa Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Wed, 16 Apr 2025 08:46:24 +0200 Subject: [PATCH] Fix. --- bookworm/scripts/lib/copy_dirtree | 6 +++--- bookworm/scripts/lib/ensure_etc_of_tags | 2 +- bookworm/scripts/lib/expect_n_args | 2 +- bookworm/scripts/setup_server.sh | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bookworm/scripts/lib/copy_dirtree b/bookworm/scripts/lib/copy_dirtree index 7a3a173..f0d5c1f 100644 --- a/bookworm/scripts/lib/copy_dirtree +++ b/bookworm/scripts/lib/copy_dirtree @@ -2,7 +2,7 @@ . lib/mkdir_p_for_user copy_dirtree() { - expect_n_args 4 99 'OWNER_TO_ENFORCE (to ignore, pass empty string) SOURCE_ROOT TARGET_ROOT TAG...' $@ + expect_n_args 4 99 'OWNER_TO_ENFORCE (to ignore, use "-") SOURCE_ROOT TARGET_ROOT TAG...' $@ _OWNER="$1" _SOURCE_ROOT="$2" _TARGET_ROOT="$3" @@ -18,11 +18,11 @@ copy_dirtree() { _PATH_TARGET="${_TARGET_ROOT}"$(echo "${_PATH_REL}" | cut -c 2-) _PATH_SOURCE=$(realpath "${_PATH_REL}") _DIRECTORY=$(dirname "${_PATH_TARGET}") - if [ ! -z "${_OWNER}" ]; then + if [ -z "${_OWNER}" = '-' ]; then mkdir_p_for_user "${_OWNER}" "${_DIRECTORY}" fi cp -av "${_PATH_SOURCE}" "${_PATH_TARGET}" - if [ ! -z "${_OWNER}" ]; then + if [ -z "${_OWNER}" '-' ]; then chown "${_OWNER}:${_OWNER}" "${_PATH_TARGET}" fi done diff --git a/bookworm/scripts/lib/ensure_etc_of_tags b/bookworm/scripts/lib/ensure_etc_of_tags index 410a677..9d590a8 100644 --- a/bookworm/scripts/lib/ensure_etc_of_tags +++ b/bookworm/scripts/lib/ensure_etc_of_tags @@ -4,5 +4,5 @@ ensure_etc_of_tags() { _PATH_CONF_ETC="${PATH_CONF}/${PATH_REL_ETC}" - copy_dirtree '' "${_PATH_CONF_ETC}" "${PATH_ETC}" $@ + copy_dirtree '-' "${_PATH_CONF_ETC}" "${PATH_ETC}" $@ } diff --git a/bookworm/scripts/lib/expect_n_args b/bookworm/scripts/lib/expect_n_args index 950671a..54f98b8 100644 --- a/bookworm/scripts/lib/expect_n_args +++ b/bookworm/scripts/lib/expect_n_args @@ -7,7 +7,7 @@ expect_n_args() { shift 3 _ABORT_MSG= if [ "$#" -lt "${_N_MIN_ARGS}" ]; then - _ABORT_MSG="missing arguments (got $# instead of ${_N_MAX_ARGS})." + _ABORT_MSG="missing arguments (got $# instead of ${_N_MIN_ARGS})." elif [ "$#" -gt "${_N_MAX_ARGS}" ]; then shift "${_N_MAX_ARGS}" _ABORT_MSG="unexpected arguments beyond expected number (${_N_MAX_ARGS}): $@" diff --git a/bookworm/scripts/setup_server.sh b/bookworm/scripts/setup_server.sh index 421068b..ddfdcb1 100755 --- a/bookworm/scripts/setup_server.sh +++ b/bookworm/scripts/setup_server.sh @@ -59,8 +59,8 @@ systemctl enable --now nftables echo "Adapting caddy's config and reloading it …" HASH=$(caddy hash-password --plaintext "${WEB_PASSWORD}") -sed -i "s/REPLACE_WITH_HASH/${HASH}/g" "${PATH_CADDYFILE}" -sed -i "s/REPLACE_WITH_FQDN/${FQDN}/g" "${PATH_CADDYFILE}" +sed -i 's/REPLACE_WITH_HASH/'"${HASH}"'/g' "${PATH_CADDYFILE}" +sed -i 's/REPLACE_WITH_FQDN/'"${FQDN}"'/g' "${PATH_CADDYFILE}" mkdir -p /var/www/dump/private /var/www/dump/public systemctl reload caddy -- 2.30.2