--- /dev/null
+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
+}
. 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"
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}"
. 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' $@
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}."
--- /dev/null
+../../../bookworm/scripts/lib/mkdir_p_print_top
\ No newline at end of file
. 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