From: Christian Heller Date: Tue, 15 Apr 2025 22:33:01 +0000 (+0200) Subject: Fix. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/process_titles?a=commitdiff_plain;h=8c54db30794e1c4a2633f70e171f9ba343bf6e16;p=config Fix. --- diff --git a/bookworm/scripts/lib/mkdir_p_print_top b/bookworm/scripts/lib/mkdir_p_print_top new file mode 100644 index 0000000..b88d63a --- /dev/null +++ b/bookworm/scripts/lib/mkdir_p_print_top @@ -0,0 +1,10 @@ +mkdir_p_print_top() { + _TO_SHORTEN=$(mkdir -pv "$1" | sed "s/mkdir: created directory '//g" | head -1) + if [ -z "${_TO_SHORTEN}" ]; then + echo '' + else + _LENGTH=$(echo -n "${_TO_SHORTEN}" | wc -c)" + _TARGET_LENGTH=$(calc "${_LENGTH} - 1" | cut -f2) + echo "${_TO_SHORTEN}" | cut -c "-${_TARGET_LENGTH}" + fi +} diff --git a/bookworm/scripts/lib/setup_users b/bookworm/scripts/lib/setup_users index 236a829..83488d6 100644 --- a/bookworm/scripts/lib/setup_users +++ b/bookworm/scripts/lib/setup_users @@ -2,6 +2,7 @@ . lib/copy_dirtree . lib/constants_user # PATH_USER_HOME, USERNAME . lib/ensure_homefiles_of_tags +. lib/mkdir_p_print_top setup_users() { _MIN_TAGS="$1" @@ -17,7 +18,7 @@ setup_users() { usermod -a -G sudo "${USERNAME}" ensure_homefiles_of_tags ${_MIN_TAGS} ${_TAGS_USER} copy_dirtree "${_PATH_CONF_HOME}" "${PATH_USER_HOME}" ${_MIN_TAGS} ${_TAGS_USER} - _TO_CHOWN=$(mkdir -pv "${_PATH_USER_BIN}" | sed 's/mkdir: created directory //g' | head -1) + _TO_CHOWN=$(mkdir_p_print_top "${_PATH_USER_BIN}") cd "${_PATH_USER_BIN}" ln -s ../../.plomlib lib chown_to_user "${_TO_CHOWN}" diff --git a/bookworm/scripts/setup_catgirl.sh b/bookworm/scripts/setup_catgirl.sh index de96083..c70655b 100755 --- a/bookworm/scripts/setup_catgirl.sh +++ b/bookworm/scripts/setup_catgirl.sh @@ -9,6 +9,7 @@ cd $(dirname "$0") . lib/ensure_homefiles_of_tags . lib/ensure_packages_of_tags . lib/expect_n_args +. lib/mkdir_p_print_top check_finished_marker 'setup_server' expect_n_args 1 1 'IRC_PASSWORD' $@ @@ -22,7 +23,7 @@ ensure_etc_of_tags catgirl ensure_homefiles_of_tags catgirl echo "\nSetting up ${PATH_USER_SHARE_CATGIRL} so logs can go there." -TO_CHOWN=$(mkdir -pv "${PATH_USER_SHARE_CATGIRL}" | sed 's/mkdir: created directory //g' | head -1) +TO_CHOWN=$(mkdir_p_print_top "${PATH_USER_SHARE_CATGIRL}") chown_to_user "${TO_CHOWN}" echo "\nWriting provided password into ${PATH_USER_CONF_CATGIRL}." diff --git a/testing/scripts/lib/mkdir_p_print_top b/testing/scripts/lib/mkdir_p_print_top new file mode 120000 index 0000000..ab3ae3b --- /dev/null +++ b/testing/scripts/lib/mkdir_p_print_top @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/mkdir_p_print_top \ No newline at end of file diff --git a/testing/scripts/setup_desktop.sh b/testing/scripts/setup_desktop.sh index f5f184e..ea3895d 100755 --- a/testing/scripts/setup_desktop.sh +++ b/testing/scripts/setup_desktop.sh @@ -7,6 +7,7 @@ cd $(dirname "$0") . lib/constants_repopaths # PATH_CONF . lib/constants_user # USERNAME . lib/determine_ip +. lib/ensure_etc_of_tags . lib/expect_min_n_args . lib/init_packages . lib/put_finished_marker