From: Christian Heller Date: Wed, 13 Aug 2025 03:53:51 +0000 (+0200) Subject: Library files should end in .sh. X-Git-Url: https://plomlompom.com/repos/booking/condition_titles?a=commitdiff_plain;h=HEAD;p=config Library files should end in .sh. --- diff --git a/bookworm/copy/all/home/plom/.plomlib/file_dot_variants b/bookworm/copy/all/home/plom/.plomlib/file_dot_variants deleted file mode 100644 index 1c1bf69..0000000 --- a/bookworm/copy/all/home/plom/.plomlib/file_dot_variants +++ /dev/null @@ -1,7 +0,0 @@ -file_dot_variants() { - for FILE in ${1}\.*; do - if [ -f "${FILE}" ]; then - . "${FILE}" - fi - done -} diff --git a/bookworm/copy/all/home/plom/.plomlib/file_dot_variants.sh b/bookworm/copy/all/home/plom/.plomlib/file_dot_variants.sh new file mode 100644 index 0000000..1c1bf69 --- /dev/null +++ b/bookworm/copy/all/home/plom/.plomlib/file_dot_variants.sh @@ -0,0 +1,7 @@ +file_dot_variants() { + for FILE in ${1}\.*; do + if [ -f "${FILE}" ]; then + . "${FILE}" + fi + done +} diff --git a/bookworm/copy/catgirl/home/plom/.plomlib/abort b/bookworm/copy/catgirl/home/plom/.plomlib/abort deleted file mode 120000 index 1fa89a1..0000000 --- a/bookworm/copy/catgirl/home/plom/.plomlib/abort +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/abort \ No newline at end of file diff --git a/bookworm/copy/catgirl/home/plom/.plomlib/abort.sh b/bookworm/copy/catgirl/home/plom/.plomlib/abort.sh new file mode 120000 index 0000000..45aefdb --- /dev/null +++ b/bookworm/copy/catgirl/home/plom/.plomlib/abort.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/abort.sh \ No newline at end of file diff --git a/bookworm/copy/catgirl/home/plom/.plomlib/constants_user b/bookworm/copy/catgirl/home/plom/.plomlib/constants_user deleted file mode 120000 index 6aa6571..0000000 --- a/bookworm/copy/catgirl/home/plom/.plomlib/constants_user +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/constants_user \ No newline at end of file diff --git a/bookworm/copy/catgirl/home/plom/.plomlib/constants_user.sh b/bookworm/copy/catgirl/home/plom/.plomlib/constants_user.sh new file mode 120000 index 0000000..dc8c43e --- /dev/null +++ b/bookworm/copy/catgirl/home/plom/.plomlib/constants_user.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/constants_user.sh \ No newline at end of file diff --git a/bookworm/copy/catgirl/home/plom/.plomlib/expect_n_args b/bookworm/copy/catgirl/home/plom/.plomlib/expect_n_args deleted file mode 120000 index eddbca9..0000000 --- a/bookworm/copy/catgirl/home/plom/.plomlib/expect_n_args +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/expect_n_args \ No newline at end of file diff --git a/bookworm/copy/catgirl/home/plom/.plomlib/expect_n_args.sh b/bookworm/copy/catgirl/home/plom/.plomlib/expect_n_args.sh new file mode 120000 index 0000000..9582f5f --- /dev/null +++ b/bookworm/copy/catgirl/home/plom/.plomlib/expect_n_args.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/expect_n_args.sh \ No newline at end of file diff --git a/bookworm/copy/seedbox/home/plom/.plomlib/constants_seedbox b/bookworm/copy/seedbox/home/plom/.plomlib/constants_seedbox deleted file mode 120000 index e625e65..0000000 --- a/bookworm/copy/seedbox/home/plom/.plomlib/constants_seedbox +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/constants_seedbox \ No newline at end of file diff --git a/bookworm/copy/seedbox/home/plom/.plomlib/constants_seedbox.sh b/bookworm/copy/seedbox/home/plom/.plomlib/constants_seedbox.sh new file mode 120000 index 0000000..de9467e --- /dev/null +++ b/bookworm/copy/seedbox/home/plom/.plomlib/constants_seedbox.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/constants_seedbox.sh \ No newline at end of file diff --git a/bookworm/copy/seedbox/home/plom/.plomlib/expected_rtorrent_files b/bookworm/copy/seedbox/home/plom/.plomlib/expected_rtorrent_files deleted file mode 120000 index f71bc5e..0000000 --- a/bookworm/copy/seedbox/home/plom/.plomlib/expected_rtorrent_files +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/expected_rtorrent_files \ No newline at end of file diff --git a/bookworm/copy/seedbox/home/plom/.plomlib/expected_rtorrent_files.sh b/bookworm/copy/seedbox/home/plom/.plomlib/expected_rtorrent_files.sh new file mode 120000 index 0000000..4b56fd8 --- /dev/null +++ b/bookworm/copy/seedbox/home/plom/.plomlib/expected_rtorrent_files.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/expected_rtorrent_files.sh \ No newline at end of file diff --git a/bookworm/copy/seedbox/home/plom/.plomlib/for_line_in b/bookworm/copy/seedbox/home/plom/.plomlib/for_line_in deleted file mode 120000 index 0a015e7..0000000 --- a/bookworm/copy/seedbox/home/plom/.plomlib/for_line_in +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/for_line_in \ No newline at end of file diff --git a/bookworm/copy/seedbox/home/plom/.plomlib/for_line_in.sh b/bookworm/copy/seedbox/home/plom/.plomlib/for_line_in.sh new file mode 120000 index 0000000..5472559 --- /dev/null +++ b/bookworm/copy/seedbox/home/plom/.plomlib/for_line_in.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/for_line_in.sh \ No newline at end of file diff --git a/bookworm/scripts/diff_tagged_files.sh b/bookworm/scripts/diff_tagged_files.sh index df201d6..94d59f8 100755 --- a/bookworm/scripts/diff_tagged_files.sh +++ b/bookworm/scripts/diff_tagged_files.sh @@ -1,10 +1,10 @@ #!/bin/sh set -e cd $(dirname "$0") -. lib/abort_if_not_user -. lib/constants_user -. lib/prefixed_msg -. lib/tagdir_parsing +. lib/abort_if_not_user.sh +. lib/constants_user.sh +. lib/prefixed_msg.sh +. lib/tagdir_parsing.sh prefixed_msg_init abort_if_not_user root diff --git a/bookworm/scripts/lib/INSTALLER_VERSION b/bookworm/scripts/lib/INSTALLER_VERSION deleted file mode 100644 index bd9fd08..0000000 --- a/bookworm/scripts/lib/INSTALLER_VERSION +++ /dev/null @@ -1 +0,0 @@ -INSTALLER_VERSION=12.10.0 diff --git a/bookworm/scripts/lib/INSTALLER_VERSION.sh b/bookworm/scripts/lib/INSTALLER_VERSION.sh new file mode 100644 index 0000000..bd9fd08 --- /dev/null +++ b/bookworm/scripts/lib/INSTALLER_VERSION.sh @@ -0,0 +1 @@ +INSTALLER_VERSION=12.10.0 diff --git a/bookworm/scripts/lib/abort b/bookworm/scripts/lib/abort deleted file mode 100644 index 73f1f77..0000000 --- a/bookworm/scripts/lib/abort +++ /dev/null @@ -1,6 +0,0 @@ -. lib/prefixed_msg - -abort() { - prefixed_msg "$1" >&2 - exit 1 -} diff --git a/bookworm/scripts/lib/abort.sh b/bookworm/scripts/lib/abort.sh new file mode 100644 index 0000000..caf6412 --- /dev/null +++ b/bookworm/scripts/lib/abort.sh @@ -0,0 +1,6 @@ +. lib/prefixed_msg.sh + +abort() { + prefixed_msg "$1" >&2 + exit 1 +} diff --git a/bookworm/scripts/lib/abort_if_command_unknown b/bookworm/scripts/lib/abort_if_command_unknown deleted file mode 100644 index 81a3365..0000000 --- a/bookworm/scripts/lib/abort_if_command_unknown +++ /dev/null @@ -1,7 +0,0 @@ -. lib/abort - -abort_if_command_unknown() { - if ! which "$1" > /dev/null; then - abort "Expected command unavailable: ${1}." - fi -} diff --git a/bookworm/scripts/lib/abort_if_command_unknown.sh b/bookworm/scripts/lib/abort_if_command_unknown.sh new file mode 100644 index 0000000..37cd2c0 --- /dev/null +++ b/bookworm/scripts/lib/abort_if_command_unknown.sh @@ -0,0 +1,7 @@ +. lib/abort.sh + +abort_if_command_unknown() { + if ! which "$1" > /dev/null; then + abort "Expected command unavailable: ${1}." + fi +} diff --git a/bookworm/scripts/lib/abort_if_not_user b/bookworm/scripts/lib/abort_if_not_user deleted file mode 100644 index a7b3da3..0000000 --- a/bookworm/scripts/lib/abort_if_not_user +++ /dev/null @@ -1,7 +0,0 @@ -. lib/abort - -abort_if_not_user() { - if [ "$(whoami)" != "$1" ]; then - abort "Must be run as ${1}." - fi -} diff --git a/bookworm/scripts/lib/abort_if_not_user.sh b/bookworm/scripts/lib/abort_if_not_user.sh new file mode 100644 index 0000000..d52910e --- /dev/null +++ b/bookworm/scripts/lib/abort_if_not_user.sh @@ -0,0 +1,7 @@ +. lib/abort.sh + +abort_if_not_user() { + if [ "$(whoami)" != "$1" ]; then + abort "Must be run as ${1}." + fi +} diff --git a/bookworm/scripts/lib/apt_get_digested b/bookworm/scripts/lib/apt_get_digested deleted file mode 100644 index 2550327..0000000 --- a/bookworm/scripts/lib/apt_get_digested +++ /dev/null @@ -1,92 +0,0 @@ -. lib/for_line_in -. lib/prefixed_msg - -apt_get_digested() { -prefixed_msg_init 'apt_get_digested' - -local FINISH_LINE='apt_get_digested_FINISH_LINE' -local SEDS=\ -'|\(Reading database \.\.\. .*|IGNORE -|Generation complete.|IGNORE -|Preconfiguring packages \.\.\.|IGNORE -|Preparing to unpack [[:print:]]+ \.\.\.|IGNORE -|Unpacking [[:print:]]+ \([[:print:]]+\)( over \([[:print:]]+\))? \.\.\.|IGNORE -Adding diversion(s):|Adding '"'"'diversion of ([[:print:]]+) to ([[:print:]]+) by ([[:print:]]+)'"'"'| \3:[\1 → \2] -Created symlink(s):|Created symlink '"'"'([[:print:]]+)'"'"' → '"'"'([[:print:]]+)'"'"'\.| [\1 → \2] -FOLLOW_PREFIX|([[:print:]]+) depends on ([[:print:]]+)( \([>=]+ [[:print:]]+\))?\.|[\2 → \1] -Installing new version of config file(s):|Installing new version of config file ([[:print:]]+) \.\.\.|\1 -Processing triggers for:|Processing triggers for ([[:print:]]+) \([[:print:]]+\) \.\.\.|\1 -Purging configuration files:|Purging configuration files for ([[:print:]]+) \([[:print:]]+\) \.\.\.|\1 -Removing:|Removing ([[:print:]]+) \([[:print:]]+\) \.\.\.|\1 -Removing diversion(s):|Removing '"'"'diversion of ([[:print:]]+) to ([[:print:]]+) by ([[:print:]]+)| \3:[\1 → \2] -Removing obsolete conffile(s):|Removing obsolete conffile ([[:print:]]+) \.\.\.|\1 -Selecting previously unselected:|Selecting previously unselected package ([[:print:]]+)\.|\1 -Setting up:|Setting up ([[:print:]]+) \([[:print:]]+\) \.\.\.|\1 -Updating to current default:|Updating ([[:print:]]+) to current default.|\1 -disabled or static unit, so not starting:|([[:print:]]+) is a disabled or a static unit, not starting it\.|\1 -disabled or static unit not running, so not starting:|([[:print:]]+) is a disabled or a static unit not running, not starting it\.|\1 -BECOME_NEXT_PREFIX|dpkg: ([[:print:]]+): dependency problems, but removing anyway as you requested:|dpkg warns: removing \1 despite dependency problems: -dpkg warns: unable to delete old directories (not empty):|dpkg: warning: unable to delete old directory '"'"'([[:print:]]+)'"'"': Directory not empty|\1 -update-alternatives: providing in auto mode:|update-alternatives: using ([[:print:]]+) to provide ([[:print:]]+) \(([[:print:]]+)\) in auto mode| [\1 → \2 (\3)]' - -print_nl_if_started_printing() { - if [ -n "${STARTED_PRINTING}" ]; then - printf '\n' - fi - printf '\r' -} -local LAST_PREFIX='' -local STARTED_PRINTING= -local LEADER_PREFIX= -local APT_GET_EXIT_CODE= -local APT_LINE= -eval "set +e; DEBIAN_FRONTEND=noninteractive apt install -y $1; APT_GET_EXIT_CODE=\$?; set -e; echo ${FINISH_LINE} \${APT_GET_EXIT_CODE}" 2>&1 | while read APT_LINE; do - APT_LINE=$(printf '%s' "${APT_LINE}" | tr -d '\r') - if [ -z "${APT_LINE}" ]; then - continue - elif [ "$(echo ${APT_LINE} | cut -d' ' -f1)" = "${FINISH_LINE}" ]; then - print_nl_if_started_printing - local EXIT_CODE=$(echo ${APT_LINE} | cut -d' ' -f2) - if [ "${EXIT_CODE}" != "0" ]; then - false - fi - break - fi - local COMPRESSED_ITEM='' - local PREFIX= - try_seds() { - local SED=$1 - PREFIX=$(printf '%s' "${SED}" | cut -d'|' -f1) - local PATTERN=$(printf '^%s$' "${SED}" | cut -d'|' -f2) - local REPLACEMENT=$(printf '%s' "${SED}" | cut -d'|' -f3) - if printf '%s' "${APT_LINE}" | grep -E "${PATTERN}" > /dev/null; then - COMPRESSED_ITEM=$(printf '%s' "${APT_LINE}" | sed -E "s|${PATTERN}|${REPLACEMENT}|") - if [ "${PREFIX}" = "BECOME_NEXT_PREFIX" ]; then - LEADER_PREFIX="${COMPRESSED_ITEM}" - COMPRESSED_ITEM=IGNORE - elif [ "${PREFIX}" = "FOLLOW_PREFIX" ]; then - PREFIX="${LEADER_PREFIX}" - fi - break - fi - } - for_line_in "${SEDS}" try_seds - if [ "${COMPRESSED_ITEM}" = "IGNORE" ]; then - continue - elif [ -z "${COMPRESSED_ITEM}" ]; then - print_nl_if_started_printing - prefixed_msg_no_nl "${APT_LINE}" - LAST_PREFIX='' - else - if [ "${PREFIX}" != "${LAST_PREFIX}" ]; then - print_nl_if_started_printing - prefixed_msg_no_nl "# ${PREFIX}" - LAST_PREFIX="${PREFIX}" - fi - printf ' %s' "${COMPRESSED_ITEM}" - fi - STARTED_PRINTING=1 -done - -prefixed_msg_exit -} diff --git a/bookworm/scripts/lib/apt_get_digested.sh b/bookworm/scripts/lib/apt_get_digested.sh new file mode 100644 index 0000000..e9ac33f --- /dev/null +++ b/bookworm/scripts/lib/apt_get_digested.sh @@ -0,0 +1,92 @@ +. lib/for_line_in.sh +. lib/prefixed_msg.sh + +apt_get_digested() { +prefixed_msg_init 'apt_get_digested' + +local FINISH_LINE='apt_get_digested_FINISH_LINE' +local SEDS=\ +'|\(Reading database \.\.\. .*|IGNORE +|Generation complete.|IGNORE +|Preconfiguring packages \.\.\.|IGNORE +|Preparing to unpack [[:print:]]+ \.\.\.|IGNORE +|Unpacking [[:print:]]+ \([[:print:]]+\)( over \([[:print:]]+\))? \.\.\.|IGNORE +Adding diversion(s):|Adding '"'"'diversion of ([[:print:]]+) to ([[:print:]]+) by ([[:print:]]+)'"'"'| \3:[\1 → \2] +Created symlink(s):|Created symlink '"'"'([[:print:]]+)'"'"' → '"'"'([[:print:]]+)'"'"'\.| [\1 → \2] +FOLLOW_PREFIX|([[:print:]]+) depends on ([[:print:]]+)( \([>=]+ [[:print:]]+\))?\.|[\2 → \1] +Installing new version of config file(s):|Installing new version of config file ([[:print:]]+) \.\.\.|\1 +Processing triggers for:|Processing triggers for ([[:print:]]+) \([[:print:]]+\) \.\.\.|\1 +Purging configuration files:|Purging configuration files for ([[:print:]]+) \([[:print:]]+\) \.\.\.|\1 +Removing:|Removing ([[:print:]]+) \([[:print:]]+\) \.\.\.|\1 +Removing diversion(s):|Removing '"'"'diversion of ([[:print:]]+) to ([[:print:]]+) by ([[:print:]]+)| \3:[\1 → \2] +Removing obsolete conffile(s):|Removing obsolete conffile ([[:print:]]+) \.\.\.|\1 +Selecting previously unselected:|Selecting previously unselected package ([[:print:]]+)\.|\1 +Setting up:|Setting up ([[:print:]]+) \([[:print:]]+\) \.\.\.|\1 +Updating to current default:|Updating ([[:print:]]+) to current default.|\1 +disabled or static unit, so not starting:|([[:print:]]+) is a disabled or a static unit, not starting it\.|\1 +disabled or static unit not running, so not starting:|([[:print:]]+) is a disabled or a static unit not running, not starting it\.|\1 +BECOME_NEXT_PREFIX|dpkg: ([[:print:]]+): dependency problems, but removing anyway as you requested:|dpkg warns: removing \1 despite dependency problems: +dpkg warns: unable to delete old directories (not empty):|dpkg: warning: unable to delete old directory '"'"'([[:print:]]+)'"'"': Directory not empty|\1 +update-alternatives: providing in auto mode:|update-alternatives: using ([[:print:]]+) to provide ([[:print:]]+) \(([[:print:]]+)\) in auto mode| [\1 → \2 (\3)]' + +print_nl_if_started_printing() { + if [ -n "${STARTED_PRINTING}" ]; then + printf '\n' + fi + printf '\r' +} +local LAST_PREFIX='' +local STARTED_PRINTING= +local LEADER_PREFIX= +local APT_GET_EXIT_CODE= +local APT_LINE= +eval "set +e; DEBIAN_FRONTEND=noninteractive apt install -y $1; APT_GET_EXIT_CODE=\$?; set -e; echo ${FINISH_LINE} \${APT_GET_EXIT_CODE}" 2>&1 | while read APT_LINE; do + APT_LINE=$(printf '%s' "${APT_LINE}" | tr -d '\r') + if [ -z "${APT_LINE}" ]; then + continue + elif [ "$(echo ${APT_LINE} | cut -d' ' -f1)" = "${FINISH_LINE}" ]; then + print_nl_if_started_printing + local EXIT_CODE=$(echo ${APT_LINE} | cut -d' ' -f2) + if [ "${EXIT_CODE}" != "0" ]; then + false + fi + break + fi + local COMPRESSED_ITEM='' + local PREFIX= + try_seds() { + local SED=$1 + PREFIX=$(printf '%s' "${SED}" | cut -d'|' -f1) + local PATTERN=$(printf '^%s$' "${SED}" | cut -d'|' -f2) + local REPLACEMENT=$(printf '%s' "${SED}" | cut -d'|' -f3) + if printf '%s' "${APT_LINE}" | grep -E "${PATTERN}" > /dev/null; then + COMPRESSED_ITEM=$(printf '%s' "${APT_LINE}" | sed -E "s|${PATTERN}|${REPLACEMENT}|") + if [ "${PREFIX}" = "BECOME_NEXT_PREFIX" ]; then + LEADER_PREFIX="${COMPRESSED_ITEM}" + COMPRESSED_ITEM=IGNORE + elif [ "${PREFIX}" = "FOLLOW_PREFIX" ]; then + PREFIX="${LEADER_PREFIX}" + fi + break + fi + } + for_line_in "${SEDS}" try_seds + if [ "${COMPRESSED_ITEM}" = "IGNORE" ]; then + continue + elif [ -z "${COMPRESSED_ITEM}" ]; then + print_nl_if_started_printing + prefixed_msg_no_nl "${APT_LINE}" + LAST_PREFIX='' + else + if [ "${PREFIX}" != "${LAST_PREFIX}" ]; then + print_nl_if_started_printing + prefixed_msg_no_nl "# ${PREFIX}" + LAST_PREFIX="${PREFIX}" + fi + printf ' %s' "${COMPRESSED_ITEM}" + fi + STARTED_PRINTING=1 +done + +prefixed_msg_exit +} diff --git a/bookworm/scripts/lib/check_finished_marker b/bookworm/scripts/lib/check_finished_marker deleted file mode 100644 index 8766882..0000000 --- a/bookworm/scripts/lib/check_finished_marker +++ /dev/null @@ -1,8 +0,0 @@ -. lib/constants_finished - -check_finished_marker() { - _PATH_MARKER="${PATH_ROOT_FINISHEDS}/$1" - if [ ! -f "${_PATH_MARKER}" ]; then - abort "Missing dependency, did not find marker: ${_PATH_MARKER}" - fi -} diff --git a/bookworm/scripts/lib/check_finished_marker.sh b/bookworm/scripts/lib/check_finished_marker.sh new file mode 100644 index 0000000..c3f4470 --- /dev/null +++ b/bookworm/scripts/lib/check_finished_marker.sh @@ -0,0 +1,8 @@ +. lib/constants_finished.sh + +check_finished_marker() { + _PATH_MARKER="${PATH_ROOT_FINISHEDS}/$1" + if [ ! -f "${_PATH_MARKER}" ]; then + abort "Missing dependency, did not find marker: ${_PATH_MARKER}" + fi +} diff --git a/bookworm/scripts/lib/constants_etc b/bookworm/scripts/lib/constants_etc deleted file mode 100644 index 287696e..0000000 --- a/bookworm/scripts/lib/constants_etc +++ /dev/null @@ -1,3 +0,0 @@ -PATH_REL_ETC=etc -PATH_ETC="/${PATH_REL_ETC}" - diff --git a/bookworm/scripts/lib/constants_etc.sh b/bookworm/scripts/lib/constants_etc.sh new file mode 100644 index 0000000..287696e --- /dev/null +++ b/bookworm/scripts/lib/constants_etc.sh @@ -0,0 +1,3 @@ +PATH_REL_ETC=etc +PATH_ETC="/${PATH_REL_ETC}" + diff --git a/bookworm/scripts/lib/constants_finished b/bookworm/scripts/lib/constants_finished deleted file mode 100644 index 24aafc2..0000000 --- a/bookworm/scripts/lib/constants_finished +++ /dev/null @@ -1 +0,0 @@ -PATH_ROOT_FINISHEDS=/root/.finished diff --git a/bookworm/scripts/lib/constants_finished.sh b/bookworm/scripts/lib/constants_finished.sh new file mode 100644 index 0000000..24aafc2 --- /dev/null +++ b/bookworm/scripts/lib/constants_finished.sh @@ -0,0 +1 @@ +PATH_ROOT_FINISHEDS=/root/.finished diff --git a/bookworm/scripts/lib/constants_repopaths b/bookworm/scripts/lib/constants_repopaths deleted file mode 100644 index 54bcb5f..0000000 --- a/bookworm/scripts/lib/constants_repopaths +++ /dev/null @@ -1,3 +0,0 @@ -PATH_SCRIPTS="$(pwd)" -PATH_CONF="$(dirname ${PATH_SCRIPTS})" -PATH_CONF_HOME="${PATH_CONF}/home" diff --git a/bookworm/scripts/lib/constants_repopaths.sh b/bookworm/scripts/lib/constants_repopaths.sh new file mode 100644 index 0000000..54bcb5f --- /dev/null +++ b/bookworm/scripts/lib/constants_repopaths.sh @@ -0,0 +1,3 @@ +PATH_SCRIPTS="$(pwd)" +PATH_CONF="$(dirname ${PATH_SCRIPTS})" +PATH_CONF_HOME="${PATH_CONF}/home" diff --git a/bookworm/scripts/lib/constants_seedbox b/bookworm/scripts/lib/constants_seedbox deleted file mode 100644 index c171a26..0000000 --- a/bookworm/scripts/lib/constants_seedbox +++ /dev/null @@ -1,6 +0,0 @@ -EXT_TORRENT='.torrent' -PATTERN_HASH_ONLY="^[A-Z0-9]{40}\$" -DIRNAME_DOWNLOADS='downloads' -DIRNAME_SESSION='session' -PLACEHOLDER_HASH='????????????????????????????????????????' -PLACEHOLDER_SIZE='????' diff --git a/bookworm/scripts/lib/constants_seedbox.sh b/bookworm/scripts/lib/constants_seedbox.sh new file mode 100644 index 0000000..c171a26 --- /dev/null +++ b/bookworm/scripts/lib/constants_seedbox.sh @@ -0,0 +1,6 @@ +EXT_TORRENT='.torrent' +PATTERN_HASH_ONLY="^[A-Z0-9]{40}\$" +DIRNAME_DOWNLOADS='downloads' +DIRNAME_SESSION='session' +PLACEHOLDER_HASH='????????????????????????????????????????' +PLACEHOLDER_SIZE='????' diff --git a/bookworm/scripts/lib/constants_ssh b/bookworm/scripts/lib/constants_ssh deleted file mode 100644 index 43e6ee5..0000000 --- a/bookworm/scripts/lib/constants_ssh +++ /dev/null @@ -1,3 +0,0 @@ -. lib/constants_user -PATH_REL_SSH=.ssh -PATH_USER_SSH="${PATH_USER_HOME}/${PATH_REL_SSH}" diff --git a/bookworm/scripts/lib/constants_ssh.sh b/bookworm/scripts/lib/constants_ssh.sh new file mode 100644 index 0000000..dd21e0f --- /dev/null +++ b/bookworm/scripts/lib/constants_ssh.sh @@ -0,0 +1,3 @@ +. lib/constants_user.sh +PATH_REL_SSH=.ssh +PATH_USER_SSH="${PATH_USER_HOME}/${PATH_REL_SSH}" diff --git a/bookworm/scripts/lib/constants_user b/bookworm/scripts/lib/constants_user deleted file mode 100644 index 90747aa..0000000 --- a/bookworm/scripts/lib/constants_user +++ /dev/null @@ -1,2 +0,0 @@ -USERNAME=plom -PATH_USER_HOME="/home/${USERNAME}" diff --git a/bookworm/scripts/lib/constants_user.sh b/bookworm/scripts/lib/constants_user.sh new file mode 100644 index 0000000..90747aa --- /dev/null +++ b/bookworm/scripts/lib/constants_user.sh @@ -0,0 +1,2 @@ +USERNAME=plom +PATH_USER_HOME="/home/${USERNAME}" diff --git a/bookworm/scripts/lib/copy_dirtrees_of_tags b/bookworm/scripts/lib/copy_dirtrees_of_tags deleted file mode 100644 index 4854bfa..0000000 --- a/bookworm/scripts/lib/copy_dirtrees_of_tags +++ /dev/null @@ -1,46 +0,0 @@ -. lib/tagdir_parsing - -copy_dirtrees_of_tags() { - _copy_dirtree() { - for _PATH_REL in $(tagdir_parsing__relpaths); do - _FILENAME="$(basename ${_PATH_REL})" - _PATH_TARGET_PARENT=/$(dirname "${_PATH_REL}") - - # ensure directory by mkdir -p; to avoid later chowning pre-existing directories, - # collect only what's returned by the command as actually newly created - _CREATION_SUMMARY=$(mkdir -pv "${_PATH_TARGET_PARENT}") - _CREATED_PATHS=$(echo "${_CREATION_SUMMARY}" | sed -E "s/'\$//g" | sed -E "s/^mkdir: created directory '//g") - _PATHS_WRITTEN="${_CREATED_PATHS}\n${_PATHS_WRITTEN}" - - # handle dirtree creation instruction files - if tagdir_parsing__is_killme "${_FILENAME}"; then - continue - fi - if tagdir_parsing__is_linkme "${_FILENAME}"; then - _PARSED=$(tagdir_parsing__parse_linkme "${_PATH_REL}") - _PATH_LINK=$(echo "${_PARSED}" | head -1) - _LINK_TARGET=$(echo "${_PARSED}" | tail -1) - ln -sf "${_LINK_TARGET}" "${_PATH_LINK}" - _PATHS_WRITTEN="${_PATH_LINK}\n${_PATHS_WRITTEN}" - continue - fi - - # actual file copying - _CREATION_SUMMARY=$(cp -avL "${_PATH_REL}" "${_PATH_TARGET_PARENT}") - _CREATED_PATHS=$(echo "${_CREATION_SUMMARY}" | grep -v -E '^removed ' | sed -E "s/'\$//g" | sed "s/.*' -> '//g") - _PATHS_WRITTEN="${_CREATED_PATHS}\n${_PATHS_WRITTEN}" - done - } - - _PATHS_WRITTEN= - tagdir_parsing__for_tagdir '_copy_dirtree' $@ - _PATHS_WRITTEN=$(echo "${_PATHS_WRITTEN}" | grep -v -E '^ *$') - - ## for all paths written into user home directories, chown to respective users - for _PATH in ${_PATHS_WRITTEN}; do - if [ $(echo "${_PATH}" | grep -E '^/home/' | wc -l) -gt 0 ]; then - _USERNAME=$(echo "${_PATH}" | sed -E 's/^\/home\///' | sed -E 's/\/.*//') - chown -R "${_USERNAME}:${_USERNAME}" "${_PATH}" - fi - done -} diff --git a/bookworm/scripts/lib/copy_dirtrees_of_tags.sh b/bookworm/scripts/lib/copy_dirtrees_of_tags.sh new file mode 100644 index 0000000..24f927e --- /dev/null +++ b/bookworm/scripts/lib/copy_dirtrees_of_tags.sh @@ -0,0 +1,46 @@ +. lib/tagdir_parsing.sh + +copy_dirtrees_of_tags() { + _copy_dirtree() { + for _PATH_REL in $(tagdir_parsing__relpaths); do + _FILENAME="$(basename ${_PATH_REL})" + _PATH_TARGET_PARENT=/$(dirname "${_PATH_REL}") + + # ensure directory by mkdir -p; to avoid later chowning pre-existing directories, + # collect only what's returned by the command as actually newly created + _CREATION_SUMMARY=$(mkdir -pv "${_PATH_TARGET_PARENT}") + _CREATED_PATHS=$(echo "${_CREATION_SUMMARY}" | sed -E "s/'\$//g" | sed -E "s/^mkdir: created directory '//g") + _PATHS_WRITTEN="${_CREATED_PATHS}\n${_PATHS_WRITTEN}" + + # handle dirtree creation instruction files + if tagdir_parsing__is_killme "${_FILENAME}"; then + continue + fi + if tagdir_parsing__is_linkme "${_FILENAME}"; then + _PARSED=$(tagdir_parsing__parse_linkme "${_PATH_REL}") + _PATH_LINK=$(echo "${_PARSED}" | head -1) + _LINK_TARGET=$(echo "${_PARSED}" | tail -1) + ln -sf "${_LINK_TARGET}" "${_PATH_LINK}" + _PATHS_WRITTEN="${_PATH_LINK}\n${_PATHS_WRITTEN}" + continue + fi + + # actual file copying + _CREATION_SUMMARY=$(cp -avL "${_PATH_REL}" "${_PATH_TARGET_PARENT}") + _CREATED_PATHS=$(echo "${_CREATION_SUMMARY}" | grep -v -E '^removed ' | sed -E "s/'\$//g" | sed "s/.*' -> '//g") + _PATHS_WRITTEN="${_CREATED_PATHS}\n${_PATHS_WRITTEN}" + done + } + + _PATHS_WRITTEN= + tagdir_parsing__for_tagdir '_copy_dirtree' $@ + _PATHS_WRITTEN=$(echo "${_PATHS_WRITTEN}" | grep -v -E '^ *$') + + ## for all paths written into user home directories, chown to respective users + for _PATH in ${_PATHS_WRITTEN}; do + if [ $(echo "${_PATH}" | grep -E '^/home/' | wc -l) -gt 0 ]; then + _USERNAME=$(echo "${_PATH}" | sed -E 's/^\/home\///' | sed -E 's/\/.*//') + chown -R "${_USERNAME}:${_USERNAME}" "${_PATH}" + fi + done +} diff --git a/bookworm/scripts/lib/core_setup b/bookworm/scripts/lib/core_setup deleted file mode 100644 index 3ffee0a..0000000 --- a/bookworm/scripts/lib/core_setup +++ /dev/null @@ -1,46 +0,0 @@ -. lib/apt_get_digested -. lib/constants_etc # PATH_ETC -. lib/constants_user # USERNAME -. lib/copy_dirtrees_of_tags -. lib/prefixed_msg - -core_setup() { -prefixed_msg_init 'core_setup' -prefixed_msg 'starting (performing standard installation setup steps)' - -_HOSTNAME="$1" -_FQDN="$2" -_EXTERNAL_IP="$3" -_INSTALL_TAGS="$4" - -./minimize_installation.sh ${_INSTALL_TAGS} - -prefixed_msg 'And now: dist-upgrade …' -apt_get_digested '-q -q dist-upgrade' - -prefixed_msg "Setting up user: ${USERNAME}" -adduser --quiet --disabled-password --gecos "" "${USERNAME}" -usermod -a -G sudo "${USERNAME}" - -prefixed_msg 'Copying over files, directories …' -copy_dirtrees_of_tags ${_INSTALL_TAGS} - -prefixed_msg 'Setting hostname …' -hostnamectl hostname "${_HOSTNAME}" - -prefixed_msg "Adapting ${_PATH_HOSTS} …" -_PATH_HOSTS="${PATH_ETC}/hosts" -if [ -z "${_FQDN}" ]; then - sed -i 's/REPLACE_WITH_FQDN/REPLACE_WITH_HOSTNAME.local REPLACE_WITH_HOSTNAME.localdomain/g' "${_PATH_HOSTS}" -else - sed -i 's/REPLACE_WITH_FQDN/'"${_FQDN}"'/g' "${_PATH_HOSTS}" - sed -i "s/#REPLACE_WITH_EXTERNAL_IP/${_EXTERNAL_IP}/g" "${_PATH_HOSTS}" -fi -sed -i 's/REPLACE_WITH_HOSTNAME/'"${_HOSTNAME}"'/g' "${_PATH_HOSTS}" - -prefixed_msg 'Syncing clock …' -ntpdate-debian -s - -prefixed_msg 'finished' -prefixed_msg_exit -} diff --git a/bookworm/scripts/lib/core_setup.sh b/bookworm/scripts/lib/core_setup.sh new file mode 100644 index 0000000..c916b9c --- /dev/null +++ b/bookworm/scripts/lib/core_setup.sh @@ -0,0 +1,46 @@ +. lib/apt_get_digested.sh +. lib/constants_etc.sh # PATH_ETC +. lib/constants_user.sh # USERNAME +. lib/copy_dirtrees_of_tags.sh +. lib/prefixed_msg.sh + +core_setup() { +prefixed_msg_init 'core_setup' +prefixed_msg 'starting (performing standard installation setup steps)' + +_HOSTNAME="$1" +_FQDN="$2" +_EXTERNAL_IP="$3" +_INSTALL_TAGS="$4" + +./minimize_installation.sh ${_INSTALL_TAGS} + +prefixed_msg 'And now: dist-upgrade …' +apt_get_digested '-q -q dist-upgrade' + +prefixed_msg "Setting up user: ${USERNAME}" +adduser --quiet --disabled-password --gecos "" "${USERNAME}" +usermod -a -G sudo "${USERNAME}" + +prefixed_msg 'Copying over files, directories …' +copy_dirtrees_of_tags ${_INSTALL_TAGS} + +prefixed_msg 'Setting hostname …' +hostnamectl hostname "${_HOSTNAME}" + +prefixed_msg "Adapting ${_PATH_HOSTS} …" +_PATH_HOSTS="${PATH_ETC}/hosts" +if [ -z "${_FQDN}" ]; then + sed -i 's/REPLACE_WITH_FQDN/REPLACE_WITH_HOSTNAME.local REPLACE_WITH_HOSTNAME.localdomain/g' "${_PATH_HOSTS}" +else + sed -i 's/REPLACE_WITH_FQDN/'"${_FQDN}"'/g' "${_PATH_HOSTS}" + sed -i "s/#REPLACE_WITH_EXTERNAL_IP/${_EXTERNAL_IP}/g" "${_PATH_HOSTS}" +fi +sed -i 's/REPLACE_WITH_HOSTNAME/'"${_HOSTNAME}"'/g' "${_PATH_HOSTS}" + +prefixed_msg 'Syncing clock …' +ntpdate-debian -s + +prefixed_msg 'finished' +prefixed_msg_exit +} diff --git a/bookworm/scripts/lib/ensure_packages_of_tags b/bookworm/scripts/lib/ensure_packages_of_tags deleted file mode 100644 index 3054df9..0000000 --- a/bookworm/scripts/lib/ensure_packages_of_tags +++ /dev/null @@ -1,35 +0,0 @@ -. lib/apt_get_digested -. lib/prefixed_msg - -ensure_packages_of_tags() { -prefixed_msg_init 'ensure_packages_of_tags' - -_APT_ARG="-q -q -o 'Dpkg::Options::=--force-confnew' install" -for _TAG in $@; do - prefixed_msg_no_nl "For tag '${_TAG}', " - if [ "$(echo ${_TAG} | cut -d':' -f1)" = 'keep_if_installed' ]; then - _PACKAGE=$(echo ${_TAG} | cut -d':' -f2) - printf 'checking if installed … ' - if dpkg-query -Wf '${Package}\n' | grep '^'"${_PACKAGE}"'$' > /dev/null; then - echo 'yup, keeping!' - apt_get_digested "${_APT_ARG} ${_PACKAGE}" - else - echo 'nope, nothing to keep.' - fi - continue - fi - _PATH_APTMARK_TAG="../aptmark/${_TAG}" - if [ ! -f "${_PATH_APTMARK_TAG}" ]; then - echo 'no file, ignoring.' - continue - fi - _PACKAGES=$(cat "${_PATH_APTMARK_TAG}" | sed -E 's/#.*//g' | sed -z 's/\n/ /g' | sed 's/ */ /g' | cut -c 2-) - if [ -z "${_PACKAGES}" ]; then - echo 'nothing to install.' - else - echo "ensuring installation of: ${_PACKAGES}" - apt_get_digested "${_APT_ARG} ${_PACKAGES}" - fi -done -prefixed_msg_exit -} diff --git a/bookworm/scripts/lib/ensure_packages_of_tags.sh b/bookworm/scripts/lib/ensure_packages_of_tags.sh new file mode 100644 index 0000000..04e4271 --- /dev/null +++ b/bookworm/scripts/lib/ensure_packages_of_tags.sh @@ -0,0 +1,35 @@ +. lib/apt_get_digested.sh +. lib/prefixed_msg.sh + +ensure_packages_of_tags() { +prefixed_msg_init 'ensure_packages_of_tags' + +_APT_ARG="-q -q -o 'Dpkg::Options::=--force-confnew' install" +for _TAG in $@; do + prefixed_msg_no_nl "For tag '${_TAG}', " + if [ "$(echo ${_TAG} | cut -d':' -f1)" = 'keep_if_installed' ]; then + _PACKAGE=$(echo ${_TAG} | cut -d':' -f2) + printf 'checking if installed … ' + if dpkg-query -Wf '${Package}\n' | grep '^'"${_PACKAGE}"'$' > /dev/null; then + echo 'yup, keeping!' + apt_get_digested "${_APT_ARG} ${_PACKAGE}" + else + echo 'nope, nothing to keep.' + fi + continue + fi + _PATH_APTMARK_TAG="../aptmark/${_TAG}" + if [ ! -f "${_PATH_APTMARK_TAG}" ]; then + echo 'no file, ignoring.' + continue + fi + _PACKAGES=$(cat "${_PATH_APTMARK_TAG}" | sed -E 's/#.*//g' | sed -z 's/\n/ /g' | sed 's/ */ /g' | cut -c 2-) + if [ -z "${_PACKAGES}" ]; then + echo 'nothing to install.' + else + echo "ensuring installation of: ${_PACKAGES}" + apt_get_digested "${_APT_ARG} ${_PACKAGES}" + fi +done +prefixed_msg_exit +} diff --git a/bookworm/scripts/lib/expect_n_args b/bookworm/scripts/lib/expect_n_args deleted file mode 100644 index 7db333a..0000000 --- a/bookworm/scripts/lib/expect_n_args +++ /dev/null @@ -1,21 +0,0 @@ -. lib/abort - -expect_n_args() { - _N_MIN_ARGS="$1" - _N_MAX_ARGS="$2" - _USAGE="$3" - shift 3 - _ABORT_MSG= - if [ "$#" -lt "${_N_MIN_ARGS}" ]; then - _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}): $@." - fi - if [ ! -z "${_ABORT_MSG}" ]; then - if [ ! -z "${_USAGE}" ]; then - _ABORT_MSG="${_ABORT_MSG} Expected arguments: ${_USAGE}" - fi - abort "Aborting due to ${_ABORT_MSG}" - fi -} diff --git a/bookworm/scripts/lib/expect_n_args.sh b/bookworm/scripts/lib/expect_n_args.sh new file mode 100644 index 0000000..16df938 --- /dev/null +++ b/bookworm/scripts/lib/expect_n_args.sh @@ -0,0 +1,21 @@ +. lib/abort.sh + +expect_n_args() { + _N_MIN_ARGS="$1" + _N_MAX_ARGS="$2" + _USAGE="$3" + shift 3 + _ABORT_MSG= + if [ "$#" -lt "${_N_MIN_ARGS}" ]; then + _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}): $@." + fi + if [ ! -z "${_ABORT_MSG}" ]; then + if [ ! -z "${_USAGE}" ]; then + _ABORT_MSG="${_ABORT_MSG} Expected arguments: ${_USAGE}" + fi + abort "Aborting due to ${_ABORT_MSG}" + fi +} diff --git a/bookworm/scripts/lib/expected_rtorrent_files b/bookworm/scripts/lib/expected_rtorrent_files deleted file mode 100644 index 4db0a17..0000000 --- a/bookworm/scripts/lib/expected_rtorrent_files +++ /dev/null @@ -1,12 +0,0 @@ -expected_rtorrent_files() { - local PATH_REL_TORRENT=$1 - local EXT - for EXT in '' '.rtorrent' '.libtorrent_resume'; do - if [ ! -f "${PATH_REL_TORRENT}${EXT}" ]; then - return 1 - fi - done - return 0 -} - - diff --git a/bookworm/scripts/lib/expected_rtorrent_files.sh b/bookworm/scripts/lib/expected_rtorrent_files.sh new file mode 100644 index 0000000..4db0a17 --- /dev/null +++ b/bookworm/scripts/lib/expected_rtorrent_files.sh @@ -0,0 +1,12 @@ +expected_rtorrent_files() { + local PATH_REL_TORRENT=$1 + local EXT + for EXT in '' '.rtorrent' '.libtorrent_resume'; do + if [ ! -f "${PATH_REL_TORRENT}${EXT}" ]; then + return 1 + fi + done + return 0 +} + + diff --git a/bookworm/scripts/lib/for_line_in b/bookworm/scripts/lib/for_line_in deleted file mode 100644 index 7e49bcc..0000000 --- a/bookworm/scripts/lib/for_line_in +++ /dev/null @@ -1,12 +0,0 @@ -for_line_in() { - local __LINES="$1" - local __COMMAND="$2" - local __OLD_IFS=${IFS} - local IFS=$(printf '\n\r') - local __LINE - for __LINE in ${__LINES}; do - IFS=${__OLD_IFS} - ${__COMMAND} "${__LINE}" - done - IFS=${__OLD_IFS} -} diff --git a/bookworm/scripts/lib/for_line_in.sh b/bookworm/scripts/lib/for_line_in.sh new file mode 100644 index 0000000..7e49bcc --- /dev/null +++ b/bookworm/scripts/lib/for_line_in.sh @@ -0,0 +1,12 @@ +for_line_in() { + local __LINES="$1" + local __COMMAND="$2" + local __OLD_IFS=${IFS} + local IFS=$(printf '\n\r') + local __LINE + for __LINE in ${__LINES}; do + IFS=${__OLD_IFS} + ${__COMMAND} "${__LINE}" + done + IFS=${__OLD_IFS} +} diff --git a/bookworm/scripts/lib/install_tags b/bookworm/scripts/lib/install_tags deleted file mode 100644 index 4169bd6..0000000 --- a/bookworm/scripts/lib/install_tags +++ /dev/null @@ -1,12 +0,0 @@ -. lib/copy_dirtrees_of_tags -. lib/ensure_packages_of_tags -. lib/prefixed_msg -install_tags() { - prefixed_msg_init 'install_tags' - - _INSTALL_TAGS="$@" - prefixed_msg "Installing packages and files for: ${_INSTALL_TAGS}" - ensure_packages_of_tags ${_INSTALL_TAGS} - copy_dirtrees_of_tags ${_INSTALL_TAGS} - prefixed_msg_exit -} diff --git a/bookworm/scripts/lib/install_tags.sh b/bookworm/scripts/lib/install_tags.sh new file mode 100644 index 0000000..0b5632b --- /dev/null +++ b/bookworm/scripts/lib/install_tags.sh @@ -0,0 +1,12 @@ +. lib/copy_dirtrees_of_tags.sh +. lib/ensure_packages_of_tags.sh +. lib/prefixed_msg.sh +install_tags() { + prefixed_msg_init 'install_tags' + + _INSTALL_TAGS="$@" + prefixed_msg "Installing packages and files for: ${_INSTALL_TAGS}" + ensure_packages_of_tags ${_INSTALL_TAGS} + copy_dirtrees_of_tags ${_INSTALL_TAGS} + prefixed_msg_exit +} diff --git a/bookworm/scripts/lib/prefixed_msg b/bookworm/scripts/lib/prefixed_msg deleted file mode 100644 index f9084cf..0000000 --- a/bookworm/scripts/lib/prefixed_msg +++ /dev/null @@ -1,35 +0,0 @@ -prefixed_msg_init() { - export prefixed_msg_OLD_PREFIX="${prefixed_msg_PREFIX}|${prefixed_msg_OLD_PREFIX}" - if [ -z "$1" ]; then - export prefixed_msg_PREFIX=$(basename "$0") - else - export prefixed_msg_PREFIX="$1" - fi -} - -prefixed_msg_exit() { - export prefixed_msg_PREFIX=$(echo "${prefixed_msg_OLD_PREFIX}" | cut -d'|' -f1) - export prefixed_msg_OLD_PREFIX=$(echo "${prefixed_msg_OLD_PREFIX}" | cut -d'|' -f2-) -} - - - -prefixed_msg_no_nl() { - if [ -z "${prefixed_msg_PREFIX}" ]; then - printf '%s' "$1" - return - fi - _INDENTOR='··' - _INDENT='' - _SEPARATORS=$(echo "${prefixed_msg_OLD_PREFIX}" | sed 's/[^|]//g') - while [ ! -z "${_SEPARATORS}" ]; do - _INDENT="${_INDENTOR}${_INDENT}" - _SEPARATORS=$(echo -n "${_SEPARATORS}" | cut -d'|' -f2-) - done - printf '%s%s: %s' "${_INDENT}" "${prefixed_msg_PREFIX}" "$1" -} - -prefixed_msg() { - prefixed_msg_no_nl "$1" - printf '\n' -} diff --git a/bookworm/scripts/lib/prefixed_msg.sh b/bookworm/scripts/lib/prefixed_msg.sh new file mode 100644 index 0000000..f9084cf --- /dev/null +++ b/bookworm/scripts/lib/prefixed_msg.sh @@ -0,0 +1,35 @@ +prefixed_msg_init() { + export prefixed_msg_OLD_PREFIX="${prefixed_msg_PREFIX}|${prefixed_msg_OLD_PREFIX}" + if [ -z "$1" ]; then + export prefixed_msg_PREFIX=$(basename "$0") + else + export prefixed_msg_PREFIX="$1" + fi +} + +prefixed_msg_exit() { + export prefixed_msg_PREFIX=$(echo "${prefixed_msg_OLD_PREFIX}" | cut -d'|' -f1) + export prefixed_msg_OLD_PREFIX=$(echo "${prefixed_msg_OLD_PREFIX}" | cut -d'|' -f2-) +} + + + +prefixed_msg_no_nl() { + if [ -z "${prefixed_msg_PREFIX}" ]; then + printf '%s' "$1" + return + fi + _INDENTOR='··' + _INDENT='' + _SEPARATORS=$(echo "${prefixed_msg_OLD_PREFIX}" | sed 's/[^|]//g') + while [ ! -z "${_SEPARATORS}" ]; do + _INDENT="${_INDENTOR}${_INDENT}" + _SEPARATORS=$(echo -n "${_SEPARATORS}" | cut -d'|' -f2-) + done + printf '%s%s: %s' "${_INDENT}" "${prefixed_msg_PREFIX}" "$1" +} + +prefixed_msg() { + prefixed_msg_no_nl "$1" + printf '\n' +} diff --git a/bookworm/scripts/lib/put_finished_marker b/bookworm/scripts/lib/put_finished_marker deleted file mode 100644 index baacfa4..0000000 --- a/bookworm/scripts/lib/put_finished_marker +++ /dev/null @@ -1,8 +0,0 @@ -. lib/constants_finished -. lib/prefixed_msg -put_finished_marker() { - - prefixed_msg "Marking as finished: $1" - mkdir -p "${PATH_ROOT_FINISHEDS}" - touch "${PATH_ROOT_FINISHEDS}/$1" -} diff --git a/bookworm/scripts/lib/put_finished_marker.sh b/bookworm/scripts/lib/put_finished_marker.sh new file mode 100644 index 0000000..238ee1f --- /dev/null +++ b/bookworm/scripts/lib/put_finished_marker.sh @@ -0,0 +1,8 @@ +. lib/constants_finished.sh +. lib/prefixed_msg.sh +put_finished_marker() { + + prefixed_msg "Marking as finished: $1" + mkdir -p "${PATH_ROOT_FINISHEDS}" + touch "${PATH_ROOT_FINISHEDS}/$1" +} diff --git a/bookworm/scripts/lib/tagdir_parsing b/bookworm/scripts/lib/tagdir_parsing deleted file mode 100644 index 6047e40..0000000 --- a/bookworm/scripts/lib/tagdir_parsing +++ /dev/null @@ -1,38 +0,0 @@ -tagdir_parsing__is_killme() { - test "$1" = 'KILL_ME' -} - -tagdir_parsing__for_tagdir() { - _COMMAND=$1 - shift 1 - _TAGS=$@ - for _TAG in ${_TAGS}; do - _PATH_TAG="../copy/${_TAG}" - if [ ! -d "${_PATH_TAG}" ]; then - continue - fi - cd "${_PATH_TAG}" - ${_COMMAND} - cd - > /dev/null - done -} - -tagdir_parsing__relpaths() { - find -L . -type f | cut -c 3- -} - -tagdir_parsing__is_linkme() { - echo "$1" | grep '^LINK_ME' > /dev/null -} - -tagdir_parsing__parse_linkme() { - _PATH_REL_LINKME=$1 - _PATH_REL_LINKME_PARENT=$(dirname "${_PATH_REL_LINKME}") - _LINK_TARGET=$(cat "${_PATH_REL_LINKME}" | head -1) - _LINK_NAME=$(cat "${_PATH_REL_LINKME}" | tail -1) - if [ -z "${_LINK_NAME}" ]; then - _LINK_NAME=$(basename "${_LINK_TARGET}") - fi - _PATH_ABS="/${_PATH_REL_LINKME_PARENT}/${_LINK_NAME}" - printf '%s\n%s' "${_PATH_ABS}" "${_LINK_TARGET}" -} diff --git a/bookworm/scripts/lib/tagdir_parsing.sh b/bookworm/scripts/lib/tagdir_parsing.sh new file mode 100644 index 0000000..6047e40 --- /dev/null +++ b/bookworm/scripts/lib/tagdir_parsing.sh @@ -0,0 +1,38 @@ +tagdir_parsing__is_killme() { + test "$1" = 'KILL_ME' +} + +tagdir_parsing__for_tagdir() { + _COMMAND=$1 + shift 1 + _TAGS=$@ + for _TAG in ${_TAGS}; do + _PATH_TAG="../copy/${_TAG}" + if [ ! -d "${_PATH_TAG}" ]; then + continue + fi + cd "${_PATH_TAG}" + ${_COMMAND} + cd - > /dev/null + done +} + +tagdir_parsing__relpaths() { + find -L . -type f | cut -c 3- +} + +tagdir_parsing__is_linkme() { + echo "$1" | grep '^LINK_ME' > /dev/null +} + +tagdir_parsing__parse_linkme() { + _PATH_REL_LINKME=$1 + _PATH_REL_LINKME_PARENT=$(dirname "${_PATH_REL_LINKME}") + _LINK_TARGET=$(cat "${_PATH_REL_LINKME}" | head -1) + _LINK_NAME=$(cat "${_PATH_REL_LINKME}" | tail -1) + if [ -z "${_LINK_NAME}" ]; then + _LINK_NAME=$(basename "${_LINK_TARGET}") + fi + _PATH_ABS="/${_PATH_REL_LINKME_PARENT}/${_LINK_NAME}" + printf '%s\n%s' "${_PATH_ABS}" "${_LINK_TARGET}" +} diff --git a/bookworm/scripts/lib/trapp b/bookworm/scripts/lib/trapp deleted file mode 100644 index 727a51c..0000000 --- a/bookworm/scripts/lib/trapp +++ /dev/null @@ -1,7 +0,0 @@ -trapp() { - _COMMAND="$@" - if [ -z "${_COMMAND}" ]; then - _COMMAND='-' - fi - trap "${_COMMAND}" EXIT TERM HUP INT -} diff --git a/bookworm/scripts/lib/trapp.sh b/bookworm/scripts/lib/trapp.sh new file mode 100644 index 0000000..727a51c --- /dev/null +++ b/bookworm/scripts/lib/trapp.sh @@ -0,0 +1,7 @@ +trapp() { + _COMMAND="$@" + if [ -z "${_COMMAND}" ]; then + _COMMAND='-' + fi + trap "${_COMMAND}" EXIT TERM HUP INT +} diff --git a/bookworm/scripts/minimize_installation.sh b/bookworm/scripts/minimize_installation.sh index 01183aa..1ed6fa8 100755 --- a/bookworm/scripts/minimize_installation.sh +++ b/bookworm/scripts/minimize_installation.sh @@ -1,9 +1,9 @@ #!/bin/sh set -e cd $(dirname "$0") -. lib/apt_get_digested -. lib/ensure_packages_of_tags -. lib/prefixed_msg +. lib/apt_get_digested.sh +. lib/ensure_packages_of_tags.sh +. lib/prefixed_msg.sh prefixed_msg_init _INSTALL_TAGS="$@" diff --git a/bookworm/scripts/setup_catgirl.sh b/bookworm/scripts/setup_catgirl.sh index 982a428..2a9eff2 100755 --- a/bookworm/scripts/setup_catgirl.sh +++ b/bookworm/scripts/setup_catgirl.sh @@ -1,11 +1,11 @@ #!/bin/sh set -e cd $(dirname "$0") -. lib/check_finished_marker -. lib/constants_user # PATH_USER_HOME -. lib/expect_n_args -. lib/install_tags -. lib/prefixed_msg +. lib/check_finished_marker.sh +. lib/constants_user.sh # PATH_USER_HOME +. lib/expect_n_args.sh +. lib/install_tags.sh +. lib/prefixed_msg.sh prefixed_msg_init prefixed_msg 'starting' diff --git a/bookworm/scripts/setup_seedbox.sh b/bookworm/scripts/setup_seedbox.sh index d00f856..7bbb970 100755 --- a/bookworm/scripts/setup_seedbox.sh +++ b/bookworm/scripts/setup_seedbox.sh @@ -1,10 +1,10 @@ #!/bin/sh set -e cd $(dirname "$0") -. lib/check_finished_marker -. lib/expect_n_args -. lib/install_tags -. lib/prefixed_msg +. lib/check_finished_marker.sh +. lib/expect_n_args.sh +. lib/install_tags.sh +. lib/prefixed_msg.sh prefixed_msg_init prefixed_msg 'starting' diff --git a/bookworm/scripts/setup_server.sh b/bookworm/scripts/setup_server.sh index 8b66f3e..6835f82 100755 --- a/bookworm/scripts/setup_server.sh +++ b/bookworm/scripts/setup_server.sh @@ -1,16 +1,16 @@ #!/bin/sh set -e cd $(dirname "$0") -. lib/apt_get_digested -. lib/constants_etc # PATH_ETC -. lib/constants_ssh # PATH_REL_SSH, PATH_USER_SSH -. lib/constants_user # USERNAME -. lib/copy_dirtrees_of_tags -. lib/core_setup -. lib/expect_n_args -. lib/prefixed_msg -. lib/put_finished_marker -. lib/trapp +. lib/apt_get_digested.sh +. lib/constants_etc.sh # PATH_ETC +. lib/constants_ssh.sh # PATH_REL_SSH, PATH_USER_SSH +. lib/constants_user.sh # USERNAME +. lib/copy_dirtrees_of_tags.sh +. lib/core_setup.sh +. lib/expect_n_args.sh +. lib/prefixed_msg.sh +. lib/put_finished_marker.sh +. lib/trapp.sh prefixed_msg_init prefixed_msg 'starting (setting up basics of standard server)' diff --git a/testing/scripts/init_server_access.sh b/testing/scripts/init_server_access.sh index d20ccab..ff78942 100755 --- a/testing/scripts/init_server_access.sh +++ b/testing/scripts/init_server_access.sh @@ -1,12 +1,12 @@ #!/bin/sh set -e cd $(dirname "$0") -. lib/abort_if_command_unknown -. lib/constants_ssh # PATH_REL_SSH, PATH_USER_SSH -. lib/expect_n_args -. lib/path_tmp_timestamped -. lib/prefixed_msg -. lib/trapp +. lib/abort_if_command_unknown.sh +. lib/constants_ssh.sh # PATH_REL_SSH, PATH_USER_SSH +. lib/expect_n_args.sh +. lib/path_tmp_timestamped.sh +. lib/prefixed_msg.sh +. lib/trapp.sh prefixed_msg_init 'init_server_access.sh' prefixed_msg 'starting' diff --git a/testing/scripts/lib/INSTALLER_VERSION b/testing/scripts/lib/INSTALLER_VERSION deleted file mode 120000 index 2109601..0000000 --- a/testing/scripts/lib/INSTALLER_VERSION +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/INSTALLER_VERSION \ No newline at end of file diff --git a/testing/scripts/lib/INSTALLER_VERSION.sh b/testing/scripts/lib/INSTALLER_VERSION.sh new file mode 120000 index 0000000..4c0912d --- /dev/null +++ b/testing/scripts/lib/INSTALLER_VERSION.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/INSTALLER_VERSION.sh \ No newline at end of file diff --git a/testing/scripts/lib/abort b/testing/scripts/lib/abort deleted file mode 120000 index 76dab43..0000000 --- a/testing/scripts/lib/abort +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/abort \ No newline at end of file diff --git a/testing/scripts/lib/abort.sh b/testing/scripts/lib/abort.sh new file mode 120000 index 0000000..a961839 --- /dev/null +++ b/testing/scripts/lib/abort.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/abort.sh \ No newline at end of file diff --git a/testing/scripts/lib/abort_if_command_unknown b/testing/scripts/lib/abort_if_command_unknown deleted file mode 120000 index 5d77154..0000000 --- a/testing/scripts/lib/abort_if_command_unknown +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/abort_if_command_unknown \ No newline at end of file diff --git a/testing/scripts/lib/abort_if_command_unknown.sh b/testing/scripts/lib/abort_if_command_unknown.sh new file mode 120000 index 0000000..eba2ad9 --- /dev/null +++ b/testing/scripts/lib/abort_if_command_unknown.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/abort_if_command_unknown.sh \ No newline at end of file diff --git a/testing/scripts/lib/abort_if_exists b/testing/scripts/lib/abort_if_exists deleted file mode 120000 index ff35025..0000000 --- a/testing/scripts/lib/abort_if_exists +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/abort_if_exists \ No newline at end of file diff --git a/testing/scripts/lib/abort_if_exists.sh b/testing/scripts/lib/abort_if_exists.sh new file mode 120000 index 0000000..ab12d51 --- /dev/null +++ b/testing/scripts/lib/abort_if_exists.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/abort_if_exists.sh \ No newline at end of file diff --git a/testing/scripts/lib/abort_if_not_user b/testing/scripts/lib/abort_if_not_user deleted file mode 120000 index 2ec0928..0000000 --- a/testing/scripts/lib/abort_if_not_user +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/abort_if_not_user \ No newline at end of file diff --git a/testing/scripts/lib/abort_if_not_user.sh b/testing/scripts/lib/abort_if_not_user.sh new file mode 120000 index 0000000..b15106d --- /dev/null +++ b/testing/scripts/lib/abort_if_not_user.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/abort_if_not_user.sh \ No newline at end of file diff --git a/testing/scripts/lib/abort_if_offline b/testing/scripts/lib/abort_if_offline deleted file mode 120000 index 919ba38..0000000 --- a/testing/scripts/lib/abort_if_offline +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/abort_if_offline \ No newline at end of file diff --git a/testing/scripts/lib/abort_if_offline.sh b/testing/scripts/lib/abort_if_offline.sh new file mode 120000 index 0000000..3c01292 --- /dev/null +++ b/testing/scripts/lib/abort_if_offline.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/abort_if_offline.sh \ No newline at end of file diff --git a/testing/scripts/lib/apt_get_digested b/testing/scripts/lib/apt_get_digested deleted file mode 120000 index fdf81df..0000000 --- a/testing/scripts/lib/apt_get_digested +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/apt_get_digested \ No newline at end of file diff --git a/testing/scripts/lib/apt_get_digested.sh b/testing/scripts/lib/apt_get_digested.sh new file mode 120000 index 0000000..277e0b7 --- /dev/null +++ b/testing/scripts/lib/apt_get_digested.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/apt_get_digested.sh \ No newline at end of file diff --git a/testing/scripts/lib/check_finished_marker b/testing/scripts/lib/check_finished_marker deleted file mode 120000 index ce96ad4..0000000 --- a/testing/scripts/lib/check_finished_marker +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/check_finished_marker \ No newline at end of file diff --git a/testing/scripts/lib/check_finished_marker.sh b/testing/scripts/lib/check_finished_marker.sh new file mode 120000 index 0000000..a4ba73c --- /dev/null +++ b/testing/scripts/lib/check_finished_marker.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/check_finished_marker.sh \ No newline at end of file diff --git a/testing/scripts/lib/constants_borg b/testing/scripts/lib/constants_borg deleted file mode 120000 index c4c8e4e..0000000 --- a/testing/scripts/lib/constants_borg +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/constants_borg \ No newline at end of file diff --git a/testing/scripts/lib/constants_borg.sh b/testing/scripts/lib/constants_borg.sh new file mode 120000 index 0000000..ea372f2 --- /dev/null +++ b/testing/scripts/lib/constants_borg.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/constants_borg.sh \ No newline at end of file diff --git a/testing/scripts/lib/constants_etc b/testing/scripts/lib/constants_etc deleted file mode 120000 index a2af76e..0000000 --- a/testing/scripts/lib/constants_etc +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/constants_etc \ No newline at end of file diff --git a/testing/scripts/lib/constants_etc.sh b/testing/scripts/lib/constants_etc.sh new file mode 120000 index 0000000..0804605 --- /dev/null +++ b/testing/scripts/lib/constants_etc.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/constants_etc.sh \ No newline at end of file diff --git a/testing/scripts/lib/constants_finished b/testing/scripts/lib/constants_finished deleted file mode 120000 index 0ece9e9..0000000 --- a/testing/scripts/lib/constants_finished +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/constants_finished \ No newline at end of file diff --git a/testing/scripts/lib/constants_finished.sh b/testing/scripts/lib/constants_finished.sh new file mode 120000 index 0000000..a368711 --- /dev/null +++ b/testing/scripts/lib/constants_finished.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/constants_finished.sh \ No newline at end of file diff --git a/testing/scripts/lib/constants_installer b/testing/scripts/lib/constants_installer deleted file mode 120000 index e665bda..0000000 --- a/testing/scripts/lib/constants_installer +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/constants_installer \ No newline at end of file diff --git a/testing/scripts/lib/constants_installer.sh b/testing/scripts/lib/constants_installer.sh new file mode 120000 index 0000000..21dadcc --- /dev/null +++ b/testing/scripts/lib/constants_installer.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/constants_installer.sh \ No newline at end of file diff --git a/testing/scripts/lib/constants_repopaths b/testing/scripts/lib/constants_repopaths deleted file mode 120000 index c9d7aa0..0000000 --- a/testing/scripts/lib/constants_repopaths +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/constants_repopaths \ No newline at end of file diff --git a/testing/scripts/lib/constants_repopaths.sh b/testing/scripts/lib/constants_repopaths.sh new file mode 120000 index 0000000..da7a778 --- /dev/null +++ b/testing/scripts/lib/constants_repopaths.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/constants_repopaths.sh \ No newline at end of file diff --git a/testing/scripts/lib/constants_secrets b/testing/scripts/lib/constants_secrets deleted file mode 120000 index cc75532..0000000 --- a/testing/scripts/lib/constants_secrets +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/constants_secrets \ No newline at end of file diff --git a/testing/scripts/lib/constants_secrets.sh b/testing/scripts/lib/constants_secrets.sh new file mode 120000 index 0000000..aa933e5 --- /dev/null +++ b/testing/scripts/lib/constants_secrets.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/constants_secrets.sh \ No newline at end of file diff --git a/testing/scripts/lib/constants_seedbox b/testing/scripts/lib/constants_seedbox deleted file mode 120000 index 0798f6b..0000000 --- a/testing/scripts/lib/constants_seedbox +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/constants_seedbox \ No newline at end of file diff --git a/testing/scripts/lib/constants_seedbox.sh b/testing/scripts/lib/constants_seedbox.sh new file mode 120000 index 0000000..ef75dd5 --- /dev/null +++ b/testing/scripts/lib/constants_seedbox.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/constants_seedbox.sh \ No newline at end of file diff --git a/testing/scripts/lib/constants_ssh b/testing/scripts/lib/constants_ssh deleted file mode 120000 index 53f0a7e..0000000 --- a/testing/scripts/lib/constants_ssh +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/constants_ssh \ No newline at end of file diff --git a/testing/scripts/lib/constants_ssh.sh b/testing/scripts/lib/constants_ssh.sh new file mode 120000 index 0000000..70a1581 --- /dev/null +++ b/testing/scripts/lib/constants_ssh.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/constants_ssh.sh \ No newline at end of file diff --git a/testing/scripts/lib/constants_user b/testing/scripts/lib/constants_user deleted file mode 120000 index 3f1f618..0000000 --- a/testing/scripts/lib/constants_user +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/constants_user \ No newline at end of file diff --git a/testing/scripts/lib/constants_user.sh b/testing/scripts/lib/constants_user.sh new file mode 120000 index 0000000..7e7e14c --- /dev/null +++ b/testing/scripts/lib/constants_user.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/constants_user.sh \ No newline at end of file diff --git a/testing/scripts/lib/copy_and_unmount_secrets b/testing/scripts/lib/copy_and_unmount_secrets deleted file mode 120000 index 901c52f..0000000 --- a/testing/scripts/lib/copy_and_unmount_secrets +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/copy_and_unmount_secrets \ No newline at end of file diff --git a/testing/scripts/lib/copy_and_unmount_secrets.sh b/testing/scripts/lib/copy_and_unmount_secrets.sh new file mode 120000 index 0000000..ee631bd --- /dev/null +++ b/testing/scripts/lib/copy_and_unmount_secrets.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/copy_and_unmount_secrets.sh \ No newline at end of file diff --git a/testing/scripts/lib/copy_dirtrees_of_tags b/testing/scripts/lib/copy_dirtrees_of_tags deleted file mode 120000 index c8af1dd..0000000 --- a/testing/scripts/lib/copy_dirtrees_of_tags +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/copy_dirtrees_of_tags \ No newline at end of file diff --git a/testing/scripts/lib/copy_dirtrees_of_tags.sh b/testing/scripts/lib/copy_dirtrees_of_tags.sh new file mode 120000 index 0000000..727758d --- /dev/null +++ b/testing/scripts/lib/copy_dirtrees_of_tags.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/copy_dirtrees_of_tags.sh \ No newline at end of file diff --git a/testing/scripts/lib/core_setup b/testing/scripts/lib/core_setup deleted file mode 120000 index 57b9805..0000000 --- a/testing/scripts/lib/core_setup +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/core_setup \ No newline at end of file diff --git a/testing/scripts/lib/core_setup.sh b/testing/scripts/lib/core_setup.sh new file mode 120000 index 0000000..100849a --- /dev/null +++ b/testing/scripts/lib/core_setup.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/core_setup.sh \ No newline at end of file diff --git a/testing/scripts/lib/ensure_packages_of_tags b/testing/scripts/lib/ensure_packages_of_tags deleted file mode 120000 index 220fdda..0000000 --- a/testing/scripts/lib/ensure_packages_of_tags +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/ensure_packages_of_tags \ No newline at end of file diff --git a/testing/scripts/lib/ensure_packages_of_tags.sh b/testing/scripts/lib/ensure_packages_of_tags.sh new file mode 120000 index 0000000..db727bd --- /dev/null +++ b/testing/scripts/lib/ensure_packages_of_tags.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/ensure_packages_of_tags.sh \ No newline at end of file diff --git a/testing/scripts/lib/expect_n_args b/testing/scripts/lib/expect_n_args deleted file mode 120000 index 9ec786a..0000000 --- a/testing/scripts/lib/expect_n_args +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/expect_n_args \ No newline at end of file diff --git a/testing/scripts/lib/expect_n_args.sh b/testing/scripts/lib/expect_n_args.sh new file mode 120000 index 0000000..31411d1 --- /dev/null +++ b/testing/scripts/lib/expect_n_args.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/expect_n_args.sh \ No newline at end of file diff --git a/testing/scripts/lib/expected_rtorrent_files b/testing/scripts/lib/expected_rtorrent_files deleted file mode 120000 index 74450e3..0000000 --- a/testing/scripts/lib/expected_rtorrent_files +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/expected_rtorrent_files \ No newline at end of file diff --git a/testing/scripts/lib/expected_rtorrent_files.sh b/testing/scripts/lib/expected_rtorrent_files.sh new file mode 120000 index 0000000..b05902d --- /dev/null +++ b/testing/scripts/lib/expected_rtorrent_files.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/expected_rtorrent_files.sh \ No newline at end of file diff --git a/testing/scripts/lib/for_line_in b/testing/scripts/lib/for_line_in deleted file mode 120000 index 9d87670..0000000 --- a/testing/scripts/lib/for_line_in +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/for_line_in \ No newline at end of file diff --git a/testing/scripts/lib/for_line_in.sh b/testing/scripts/lib/for_line_in.sh new file mode 120000 index 0000000..7f7c100 --- /dev/null +++ b/testing/scripts/lib/for_line_in.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/for_line_in.sh \ No newline at end of file diff --git a/testing/scripts/lib/get_mountable_device_path b/testing/scripts/lib/get_mountable_device_path deleted file mode 120000 index 15645f9..0000000 --- a/testing/scripts/lib/get_mountable_device_path +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/get_mountable_device_path \ No newline at end of file diff --git a/testing/scripts/lib/get_mountable_device_path.sh b/testing/scripts/lib/get_mountable_device_path.sh new file mode 120000 index 0000000..9f0d880 --- /dev/null +++ b/testing/scripts/lib/get_mountable_device_path.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/get_mountable_device_path.sh \ No newline at end of file diff --git a/testing/scripts/lib/get_passphrase b/testing/scripts/lib/get_passphrase deleted file mode 120000 index f38d6ac..0000000 --- a/testing/scripts/lib/get_passphrase +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/get_passphrase \ No newline at end of file diff --git a/testing/scripts/lib/get_passphrase.sh b/testing/scripts/lib/get_passphrase.sh new file mode 120000 index 0000000..9ce20cf --- /dev/null +++ b/testing/scripts/lib/get_passphrase.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/get_passphrase.sh \ No newline at end of file diff --git a/testing/scripts/lib/mount_secrets b/testing/scripts/lib/mount_secrets deleted file mode 120000 index d358809..0000000 --- a/testing/scripts/lib/mount_secrets +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/mount_secrets \ No newline at end of file diff --git a/testing/scripts/lib/mount_secrets.sh b/testing/scripts/lib/mount_secrets.sh new file mode 120000 index 0000000..3f9b11d --- /dev/null +++ b/testing/scripts/lib/mount_secrets.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/mount_secrets.sh \ No newline at end of file diff --git a/testing/scripts/lib/path_tmp_timestamped b/testing/scripts/lib/path_tmp_timestamped deleted file mode 120000 index a7ae07c..0000000 --- a/testing/scripts/lib/path_tmp_timestamped +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/path_tmp_timestamped \ No newline at end of file diff --git a/testing/scripts/lib/path_tmp_timestamped.sh b/testing/scripts/lib/path_tmp_timestamped.sh new file mode 120000 index 0000000..00b9990 --- /dev/null +++ b/testing/scripts/lib/path_tmp_timestamped.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/path_tmp_timestamped.sh \ No newline at end of file diff --git a/testing/scripts/lib/prefixed_msg b/testing/scripts/lib/prefixed_msg deleted file mode 120000 index 713bd58..0000000 --- a/testing/scripts/lib/prefixed_msg +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/prefixed_msg \ No newline at end of file diff --git a/testing/scripts/lib/prefixed_msg.sh b/testing/scripts/lib/prefixed_msg.sh new file mode 120000 index 0000000..9d81897 --- /dev/null +++ b/testing/scripts/lib/prefixed_msg.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/prefixed_msg.sh \ No newline at end of file diff --git a/testing/scripts/lib/put_finished_marker b/testing/scripts/lib/put_finished_marker deleted file mode 120000 index 8f3439a..0000000 --- a/testing/scripts/lib/put_finished_marker +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/put_finished_marker \ No newline at end of file diff --git a/testing/scripts/lib/put_finished_marker.sh b/testing/scripts/lib/put_finished_marker.sh new file mode 120000 index 0000000..dda5340 --- /dev/null +++ b/testing/scripts/lib/put_finished_marker.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/put_finished_marker.sh \ No newline at end of file diff --git a/testing/scripts/lib/retry_until b/testing/scripts/lib/retry_until deleted file mode 120000 index 0b0c894..0000000 --- a/testing/scripts/lib/retry_until +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/retry_until \ No newline at end of file diff --git a/testing/scripts/lib/retry_until.sh b/testing/scripts/lib/retry_until.sh new file mode 120000 index 0000000..296627b --- /dev/null +++ b/testing/scripts/lib/retry_until.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/retry_until.sh \ No newline at end of file diff --git a/testing/scripts/lib/tagdir_parsing b/testing/scripts/lib/tagdir_parsing deleted file mode 120000 index 200a36f..0000000 --- a/testing/scripts/lib/tagdir_parsing +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/tagdir_parsing \ No newline at end of file diff --git a/testing/scripts/lib/tagdir_parsing.sh b/testing/scripts/lib/tagdir_parsing.sh new file mode 120000 index 0000000..69297e7 --- /dev/null +++ b/testing/scripts/lib/tagdir_parsing.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/tagdir_parsing.sh \ No newline at end of file diff --git a/testing/scripts/lib/trapp b/testing/scripts/lib/trapp deleted file mode 120000 index c9180a7..0000000 --- a/testing/scripts/lib/trapp +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/trapp \ No newline at end of file diff --git a/testing/scripts/lib/trapp.sh b/testing/scripts/lib/trapp.sh new file mode 120000 index 0000000..64770e1 --- /dev/null +++ b/testing/scripts/lib/trapp.sh @@ -0,0 +1 @@ +../../../trixie/scripts/lib/trapp.sh \ No newline at end of file diff --git a/testing/scripts/pull_catgirl_logs.sh b/testing/scripts/pull_catgirl_logs.sh index 443c793..e760b4c 100755 --- a/testing/scripts/pull_catgirl_logs.sh +++ b/testing/scripts/pull_catgirl_logs.sh @@ -1,13 +1,13 @@ #!/bin/sh set -e cd $(dirname "$0") -. lib/abort_if_command_unknown -. lib/abort_if_offline -. lib/constants_ssh # PATH_USER_SSH -. lib/expect_n_args -. lib/path_tmp_timestamped -. lib/prefixed_msg -. lib/trapp +. lib/abort_if_command_unknown.sh +. lib/abort_if_offline.sh +. lib/constants_ssh.sh # PATH_USER_SSH +. lib/expect_n_args.sh +. lib/path_tmp_timestamped.sh +. lib/prefixed_msg.sh +. lib/trapp.sh prefixed_msg_init diff --git a/testing/scripts/sync_rtorrent_download.sh b/testing/scripts/sync_rtorrent_download.sh index 52cdbb7..3c5aadb 100755 --- a/testing/scripts/sync_rtorrent_download.sh +++ b/testing/scripts/sync_rtorrent_download.sh @@ -1,14 +1,14 @@ #!/bin/sh set -eC cd $(dirname "$0") -. lib/abort -. lib/abort_if_exists -. lib/abort_if_offline -. lib/constants_seedbox -. lib/expect_n_args -. lib/expected_rtorrent_files -. lib/for_line_in -. lib/trapp +. lib/abort.sh +. lib/abort_if_exists.sh +. lib/abort_if_offline.sh +. lib/constants_seedbox.sh +. lib/expect_n_args.sh +. lib/expected_rtorrent_files.sh +. lib/for_line_in.sh +. lib/trapp.sh cd - > /dev/null DIRNAME_DOWNLOAD='download' diff --git a/trixie/copy/desktop/home/plom/.plomlib/abort b/trixie/copy/desktop/home/plom/.plomlib/abort deleted file mode 120000 index 1fa89a1..0000000 --- a/trixie/copy/desktop/home/plom/.plomlib/abort +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/abort \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/abort.sh b/trixie/copy/desktop/home/plom/.plomlib/abort.sh new file mode 120000 index 0000000..45aefdb --- /dev/null +++ b/trixie/copy/desktop/home/plom/.plomlib/abort.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/abort.sh \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/abort_if_exists b/trixie/copy/desktop/home/plom/.plomlib/abort_if_exists deleted file mode 120000 index 2c89f91..0000000 --- a/trixie/copy/desktop/home/plom/.plomlib/abort_if_exists +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/abort_if_exists \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/abort_if_exists.sh b/trixie/copy/desktop/home/plom/.plomlib/abort_if_exists.sh new file mode 120000 index 0000000..038c42c --- /dev/null +++ b/trixie/copy/desktop/home/plom/.plomlib/abort_if_exists.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/abort_if_exists.sh \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/audio_dev_is_mute b/trixie/copy/desktop/home/plom/.plomlib/audio_dev_is_mute deleted file mode 100644 index d45fc53..0000000 --- a/trixie/copy/desktop/home/plom/.plomlib/audio_dev_is_mute +++ /dev/null @@ -1,5 +0,0 @@ -audio_dev_is_mute() { - _TYPE="$1" - _IDX="$2" - [ "$(pactl get-${_TYPE}-mute ${_IDX})" = "Mute: yes" ] -} diff --git a/trixie/copy/desktop/home/plom/.plomlib/audio_dev_is_mute.sh b/trixie/copy/desktop/home/plom/.plomlib/audio_dev_is_mute.sh new file mode 100644 index 0000000..d45fc53 --- /dev/null +++ b/trixie/copy/desktop/home/plom/.plomlib/audio_dev_is_mute.sh @@ -0,0 +1,5 @@ +audio_dev_is_mute() { + _TYPE="$1" + _IDX="$2" + [ "$(pactl get-${_TYPE}-mute ${_IDX})" = "Mute: yes" ] +} diff --git a/trixie/copy/desktop/home/plom/.plomlib/constants_borg b/trixie/copy/desktop/home/plom/.plomlib/constants_borg deleted file mode 120000 index 11fd28a..0000000 --- a/trixie/copy/desktop/home/plom/.plomlib/constants_borg +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/constants_borg \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/constants_borg.sh b/trixie/copy/desktop/home/plom/.plomlib/constants_borg.sh new file mode 120000 index 0000000..72e1188 --- /dev/null +++ b/trixie/copy/desktop/home/plom/.plomlib/constants_borg.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/constants_borg.sh \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/constants_secrets b/trixie/copy/desktop/home/plom/.plomlib/constants_secrets deleted file mode 120000 index c44c50b..0000000 --- a/trixie/copy/desktop/home/plom/.plomlib/constants_secrets +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/constants_secrets \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/constants_secrets.sh b/trixie/copy/desktop/home/plom/.plomlib/constants_secrets.sh new file mode 120000 index 0000000..66f96c9 --- /dev/null +++ b/trixie/copy/desktop/home/plom/.plomlib/constants_secrets.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/constants_secrets.sh \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/constants_ssh b/trixie/copy/desktop/home/plom/.plomlib/constants_ssh deleted file mode 120000 index edc00a7..0000000 --- a/trixie/copy/desktop/home/plom/.plomlib/constants_ssh +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/constants_ssh \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/constants_ssh.sh b/trixie/copy/desktop/home/plom/.plomlib/constants_ssh.sh new file mode 120000 index 0000000..fedda73 --- /dev/null +++ b/trixie/copy/desktop/home/plom/.plomlib/constants_ssh.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/constants_ssh.sh \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/constants_user b/trixie/copy/desktop/home/plom/.plomlib/constants_user deleted file mode 120000 index 6aa6571..0000000 --- a/trixie/copy/desktop/home/plom/.plomlib/constants_user +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/constants_user \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/constants_user.sh b/trixie/copy/desktop/home/plom/.plomlib/constants_user.sh new file mode 120000 index 0000000..dc8c43e --- /dev/null +++ b/trixie/copy/desktop/home/plom/.plomlib/constants_user.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/constants_user.sh \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/copy_and_unmount_secrets b/trixie/copy/desktop/home/plom/.plomlib/copy_and_unmount_secrets deleted file mode 120000 index c215403..0000000 --- a/trixie/copy/desktop/home/plom/.plomlib/copy_and_unmount_secrets +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/copy_and_unmount_secrets \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/copy_and_unmount_secrets.sh b/trixie/copy/desktop/home/plom/.plomlib/copy_and_unmount_secrets.sh new file mode 120000 index 0000000..22162a6 --- /dev/null +++ b/trixie/copy/desktop/home/plom/.plomlib/copy_and_unmount_secrets.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/copy_and_unmount_secrets.sh \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/expect_n_args b/trixie/copy/desktop/home/plom/.plomlib/expect_n_args deleted file mode 120000 index eddbca9..0000000 --- a/trixie/copy/desktop/home/plom/.plomlib/expect_n_args +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/expect_n_args \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/expect_n_args.sh b/trixie/copy/desktop/home/plom/.plomlib/expect_n_args.sh new file mode 120000 index 0000000..9582f5f --- /dev/null +++ b/trixie/copy/desktop/home/plom/.plomlib/expect_n_args.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/expect_n_args.sh \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/get_passphrase b/trixie/copy/desktop/home/plom/.plomlib/get_passphrase deleted file mode 120000 index e7d3829..0000000 --- a/trixie/copy/desktop/home/plom/.plomlib/get_passphrase +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/get_passphrase \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/get_passphrase.sh b/trixie/copy/desktop/home/plom/.plomlib/get_passphrase.sh new file mode 120000 index 0000000..72c1166 --- /dev/null +++ b/trixie/copy/desktop/home/plom/.plomlib/get_passphrase.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/get_passphrase.sh \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/mount_secrets b/trixie/copy/desktop/home/plom/.plomlib/mount_secrets deleted file mode 120000 index 62637a7..0000000 --- a/trixie/copy/desktop/home/plom/.plomlib/mount_secrets +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/mount_secrets \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/mount_secrets.sh b/trixie/copy/desktop/home/plom/.plomlib/mount_secrets.sh new file mode 120000 index 0000000..5cff252 --- /dev/null +++ b/trixie/copy/desktop/home/plom/.plomlib/mount_secrets.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/mount_secrets.sh \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/path_tmp_timestamped b/trixie/copy/desktop/home/plom/.plomlib/path_tmp_timestamped deleted file mode 120000 index 85c7c4b..0000000 --- a/trixie/copy/desktop/home/plom/.plomlib/path_tmp_timestamped +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/path_tmp_timestamped \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/path_tmp_timestamped.sh b/trixie/copy/desktop/home/plom/.plomlib/path_tmp_timestamped.sh new file mode 120000 index 0000000..42e3708 --- /dev/null +++ b/trixie/copy/desktop/home/plom/.plomlib/path_tmp_timestamped.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/path_tmp_timestamped.sh \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/prefixed_msg b/trixie/copy/desktop/home/plom/.plomlib/prefixed_msg deleted file mode 120000 index 42ff428..0000000 --- a/trixie/copy/desktop/home/plom/.plomlib/prefixed_msg +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/prefixed_msg \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/prefixed_msg.sh b/trixie/copy/desktop/home/plom/.plomlib/prefixed_msg.sh new file mode 120000 index 0000000..e9c316f --- /dev/null +++ b/trixie/copy/desktop/home/plom/.plomlib/prefixed_msg.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/prefixed_msg.sh \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/print_usage b/trixie/copy/desktop/home/plom/.plomlib/print_usage deleted file mode 100644 index 58abe1c..0000000 --- a/trixie/copy/desktop/home/plom/.plomlib/print_usage +++ /dev/null @@ -1,36 +0,0 @@ -print_usage() { - echo 'Usage:' - echo "${USAGE_LINES}" | while read _LINE; do - echo " $(basename $0) ${_LINE}" - done - echo "\n${USAGE_DESCRIPTION}\n" - _var_of() { eval printf '"%s"' '"${'"${1}${2}"'}"'; } - _build_index() { - _ARGS="$(_var_of 'USAGE_ARGS_' ${_IDX})" - if [ ! -z "${_ARGS}" ]; then - _ARGS=" ${_ARGS}" - fi - _NAME="${_IDX}" - _ALT_NAME="$(_var_of 'USAGE_NAME_' ${_IDX})" - if [ ! -z "${_ALT_NAME}" ]; then - _NAME="${_ALT_NAME}" - fi - _KEY=" ${_NAME}${_ARGS}" - } - _MAX_LEN_KEY=0 - for _IDX in ${USAGE_INDICES}; do - _build_index - if [ ${#_KEY} -gt "${_MAX_LEN_KEY}" ]; then - _MAX_LEN_KEY=${#_KEY} - fi - done - for _IDX in ${USAGE_INDICES}; do - _build_index - printf '%s' "${_KEY}" - _LEN_GAP=$(calc "${_MAX_LEN_KEY} - ${#_KEY} + 4") - for _ in $(seq 1 ${_LEN_GAP}); do - printf ' ' - done - printf '%s\n' "$(_var_of 'USAGE_DESC_' ${_IDX})" - done -} diff --git a/trixie/copy/desktop/home/plom/.plomlib/print_usage.sh b/trixie/copy/desktop/home/plom/.plomlib/print_usage.sh new file mode 100644 index 0000000..58abe1c --- /dev/null +++ b/trixie/copy/desktop/home/plom/.plomlib/print_usage.sh @@ -0,0 +1,36 @@ +print_usage() { + echo 'Usage:' + echo "${USAGE_LINES}" | while read _LINE; do + echo " $(basename $0) ${_LINE}" + done + echo "\n${USAGE_DESCRIPTION}\n" + _var_of() { eval printf '"%s"' '"${'"${1}${2}"'}"'; } + _build_index() { + _ARGS="$(_var_of 'USAGE_ARGS_' ${_IDX})" + if [ ! -z "${_ARGS}" ]; then + _ARGS=" ${_ARGS}" + fi + _NAME="${_IDX}" + _ALT_NAME="$(_var_of 'USAGE_NAME_' ${_IDX})" + if [ ! -z "${_ALT_NAME}" ]; then + _NAME="${_ALT_NAME}" + fi + _KEY=" ${_NAME}${_ARGS}" + } + _MAX_LEN_KEY=0 + for _IDX in ${USAGE_INDICES}; do + _build_index + if [ ${#_KEY} -gt "${_MAX_LEN_KEY}" ]; then + _MAX_LEN_KEY=${#_KEY} + fi + done + for _IDX in ${USAGE_INDICES}; do + _build_index + printf '%s' "${_KEY}" + _LEN_GAP=$(calc "${_MAX_LEN_KEY} - ${#_KEY} + 4") + for _ in $(seq 1 ${_LEN_GAP}); do + printf ' ' + done + printf '%s\n' "$(_var_of 'USAGE_DESC_' ${_IDX})" + done +} diff --git a/trixie/copy/desktop/home/plom/.plomlib/retry_until b/trixie/copy/desktop/home/plom/.plomlib/retry_until deleted file mode 120000 index 5fa5898..0000000 --- a/trixie/copy/desktop/home/plom/.plomlib/retry_until +++ /dev/null @@ -1 +0,0 @@ -../../../../../scripts/lib/retry_until \ No newline at end of file diff --git a/trixie/copy/desktop/home/plom/.plomlib/retry_until.sh b/trixie/copy/desktop/home/plom/.plomlib/retry_until.sh new file mode 120000 index 0000000..ba73472 --- /dev/null +++ b/trixie/copy/desktop/home/plom/.plomlib/retry_until.sh @@ -0,0 +1 @@ +../../../../../scripts/lib/retry_until.sh \ No newline at end of file diff --git a/trixie/scripts/_setup_secrets_user.sh b/trixie/scripts/_setup_secrets_user.sh index 60fc651..fc95d2d 100644 --- a/trixie/scripts/_setup_secrets_user.sh +++ b/trixie/scripts/_setup_secrets_user.sh @@ -1,20 +1,20 @@ #!/bin/sh set -e cd $(dirname "$0") -. lib/abort +. lib/abort.sh # . lib/abort_if_exists -. lib/abort_if_not_user -. lib/abort_if_offline +. lib/abort_if_not_user.sh +. lib/abort_if_offline.sh # . lib/constants_secrets # PATH_SECRETS, PATH_SECRETS_KDBX, PATH_SECRETS_SSH, PATH_SECRETS_BORGKEYS, PATH_USER_KDBX -. lib/constants_ssh # PATH_USER_SSH -. lib/constants_user # USERNAME +. lib/constants_ssh.sh # PATH_USER_SSH +. lib/constants_user.sh # USERNAME # . lib/constants_borg # NAME_BORGAPP # . lib/copy_and_unmount_secrets -. lib/expect_n_args +. lib/expect_n_args.sh # . lib/mount_secrets -. lib/prefixed_msg +. lib/prefixed_msg.sh # . lib/retry_until -. lib/trapp +. lib/trapp.sh prefixed_msg_init PATH_REPOS="${HOME}/repos" diff --git a/trixie/scripts/from_older_upgrade.sh b/trixie/scripts/from_older_upgrade.sh index 89b8a49..d699318 100755 --- a/trixie/scripts/from_older_upgrade.sh +++ b/trixie/scripts/from_older_upgrade.sh @@ -1,13 +1,13 @@ #!/bin/sh set -e cd $(dirname "$0") -. lib/abort -. lib/apt_get_digested -. lib/constants_etc # PATH_ETC -. lib/constants_releases # PREV_RELEASE, THIS_RELEASE -. lib/expect_n_args -. lib/prefixed_msg -. lib/tagdir_parsing +. lib/abort.sh +. lib/apt_get_digested.sh +. lib/constants_etc.sh # PATH_ETC +. lib/constants_releases.sh # PREV_RELEASE, THIS_RELEASE +. lib/expect_n_args.sh +. lib/prefixed_msg.sh +. lib/tagdir_parsing.sh prefixed_msg_init MSG_ALLOWED_INSTALLATION_TYPES='either "server" or "desktop"' diff --git a/trixie/scripts/lib/INSTALLER_VERSION b/trixie/scripts/lib/INSTALLER_VERSION deleted file mode 100644 index d9aceff..0000000 --- a/trixie/scripts/lib/INSTALLER_VERSION +++ /dev/null @@ -1 +0,0 @@ -INSTALLER_VERSION=13.0.0 diff --git a/trixie/scripts/lib/INSTALLER_VERSION.sh b/trixie/scripts/lib/INSTALLER_VERSION.sh new file mode 100644 index 0000000..d9aceff --- /dev/null +++ b/trixie/scripts/lib/INSTALLER_VERSION.sh @@ -0,0 +1 @@ +INSTALLER_VERSION=13.0.0 diff --git a/trixie/scripts/lib/abort b/trixie/scripts/lib/abort deleted file mode 120000 index 5574233..0000000 --- a/trixie/scripts/lib/abort +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/abort \ No newline at end of file diff --git a/trixie/scripts/lib/abort.sh b/trixie/scripts/lib/abort.sh new file mode 120000 index 0000000..ccda89b --- /dev/null +++ b/trixie/scripts/lib/abort.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/abort.sh \ No newline at end of file diff --git a/trixie/scripts/lib/abort_if_command_unknown b/trixie/scripts/lib/abort_if_command_unknown deleted file mode 120000 index 5d77154..0000000 --- a/trixie/scripts/lib/abort_if_command_unknown +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/abort_if_command_unknown \ No newline at end of file diff --git a/trixie/scripts/lib/abort_if_command_unknown.sh b/trixie/scripts/lib/abort_if_command_unknown.sh new file mode 120000 index 0000000..eba2ad9 --- /dev/null +++ b/trixie/scripts/lib/abort_if_command_unknown.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/abort_if_command_unknown.sh \ No newline at end of file diff --git a/trixie/scripts/lib/abort_if_exists b/trixie/scripts/lib/abort_if_exists deleted file mode 100644 index 33f49d5..0000000 --- a/trixie/scripts/lib/abort_if_exists +++ /dev/null @@ -1,7 +0,0 @@ -. lib/abort - -abort_if_exists() { - if [ -e "$1" ]; then - abort "Aborting since $1 already exists." - fi -} diff --git a/trixie/scripts/lib/abort_if_exists.sh b/trixie/scripts/lib/abort_if_exists.sh new file mode 100644 index 0000000..21e1eee --- /dev/null +++ b/trixie/scripts/lib/abort_if_exists.sh @@ -0,0 +1,7 @@ +. lib/abort.sh + +abort_if_exists() { + if [ -e "$1" ]; then + abort "Aborting since $1 already exists." + fi +} diff --git a/trixie/scripts/lib/abort_if_not_user b/trixie/scripts/lib/abort_if_not_user deleted file mode 120000 index b152dca..0000000 --- a/trixie/scripts/lib/abort_if_not_user +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/abort_if_not_user \ No newline at end of file diff --git a/trixie/scripts/lib/abort_if_not_user.sh b/trixie/scripts/lib/abort_if_not_user.sh new file mode 120000 index 0000000..04fab98 --- /dev/null +++ b/trixie/scripts/lib/abort_if_not_user.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/abort_if_not_user.sh \ No newline at end of file diff --git a/trixie/scripts/lib/abort_if_offline b/trixie/scripts/lib/abort_if_offline deleted file mode 100644 index b81c784..0000000 --- a/trixie/scripts/lib/abort_if_offline +++ /dev/null @@ -1,7 +0,0 @@ -. lib/abort - -abort_if_offline() { - if ! ping -c1 -W2 1.1.1.1 > /dev/null 2>&1; then - abort 'Must be run online.' - fi -} diff --git a/trixie/scripts/lib/abort_if_offline.sh b/trixie/scripts/lib/abort_if_offline.sh new file mode 100644 index 0000000..7a8f6ac --- /dev/null +++ b/trixie/scripts/lib/abort_if_offline.sh @@ -0,0 +1,7 @@ +. lib/abort.sh + +abort_if_offline() { + if ! ping -c1 -W2 1.1.1.1 > /dev/null 2>&1; then + abort 'Must be run online.' + fi +} diff --git a/trixie/scripts/lib/apt_get_digested b/trixie/scripts/lib/apt_get_digested deleted file mode 120000 index 939b040..0000000 --- a/trixie/scripts/lib/apt_get_digested +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/apt_get_digested \ No newline at end of file diff --git a/trixie/scripts/lib/apt_get_digested.sh b/trixie/scripts/lib/apt_get_digested.sh new file mode 120000 index 0000000..f797993 --- /dev/null +++ b/trixie/scripts/lib/apt_get_digested.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/apt_get_digested.sh \ No newline at end of file diff --git a/trixie/scripts/lib/check_finished_marker b/trixie/scripts/lib/check_finished_marker deleted file mode 120000 index d8daf8f..0000000 --- a/trixie/scripts/lib/check_finished_marker +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/check_finished_marker \ No newline at end of file diff --git a/trixie/scripts/lib/check_finished_marker.sh b/trixie/scripts/lib/check_finished_marker.sh new file mode 120000 index 0000000..1f6e673 --- /dev/null +++ b/trixie/scripts/lib/check_finished_marker.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/check_finished_marker.sh \ No newline at end of file diff --git a/trixie/scripts/lib/constants_borg b/trixie/scripts/lib/constants_borg deleted file mode 100644 index befcb4a..0000000 --- a/trixie/scripts/lib/constants_borg +++ /dev/null @@ -1,2 +0,0 @@ -NAME_BORGAPP=borgplom -PATH_BORG_CONF="${HOME}/.config/borg" diff --git a/trixie/scripts/lib/constants_borg.sh b/trixie/scripts/lib/constants_borg.sh new file mode 100644 index 0000000..befcb4a --- /dev/null +++ b/trixie/scripts/lib/constants_borg.sh @@ -0,0 +1,2 @@ +NAME_BORGAPP=borgplom +PATH_BORG_CONF="${HOME}/.config/borg" diff --git a/trixie/scripts/lib/constants_etc b/trixie/scripts/lib/constants_etc deleted file mode 120000 index 5c4073f..0000000 --- a/trixie/scripts/lib/constants_etc +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/constants_etc \ No newline at end of file diff --git a/trixie/scripts/lib/constants_etc.sh b/trixie/scripts/lib/constants_etc.sh new file mode 120000 index 0000000..c442dc5 --- /dev/null +++ b/trixie/scripts/lib/constants_etc.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/constants_etc.sh \ No newline at end of file diff --git a/trixie/scripts/lib/constants_finished b/trixie/scripts/lib/constants_finished deleted file mode 120000 index ec93895..0000000 --- a/trixie/scripts/lib/constants_finished +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/constants_finished \ No newline at end of file diff --git a/trixie/scripts/lib/constants_finished.sh b/trixie/scripts/lib/constants_finished.sh new file mode 120000 index 0000000..dc95266 --- /dev/null +++ b/trixie/scripts/lib/constants_finished.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/constants_finished.sh \ No newline at end of file diff --git a/trixie/scripts/lib/constants_installer b/trixie/scripts/lib/constants_installer deleted file mode 100644 index 76e1589..0000000 --- a/trixie/scripts/lib/constants_installer +++ /dev/null @@ -1,2 +0,0 @@ -FILENAME_PRESEED_CFG=preseed.cfg -PATH_PRESEED_CFG=$(realpath "../${FILENAME_PRESEED_CFG}") diff --git a/trixie/scripts/lib/constants_installer.sh b/trixie/scripts/lib/constants_installer.sh new file mode 100644 index 0000000..76e1589 --- /dev/null +++ b/trixie/scripts/lib/constants_installer.sh @@ -0,0 +1,2 @@ +FILENAME_PRESEED_CFG=preseed.cfg +PATH_PRESEED_CFG=$(realpath "../${FILENAME_PRESEED_CFG}") diff --git a/trixie/scripts/lib/constants_releases b/trixie/scripts/lib/constants_releases deleted file mode 100644 index 115cd44..0000000 --- a/trixie/scripts/lib/constants_releases +++ /dev/null @@ -1,2 +0,0 @@ -PREV_RELEASE=bookworm -THIS_RELEASE=trixie diff --git a/trixie/scripts/lib/constants_releases.sh b/trixie/scripts/lib/constants_releases.sh new file mode 100644 index 0000000..115cd44 --- /dev/null +++ b/trixie/scripts/lib/constants_releases.sh @@ -0,0 +1,2 @@ +PREV_RELEASE=bookworm +THIS_RELEASE=trixie diff --git a/trixie/scripts/lib/constants_repopaths b/trixie/scripts/lib/constants_repopaths deleted file mode 120000 index d796f1c..0000000 --- a/trixie/scripts/lib/constants_repopaths +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/constants_repopaths \ No newline at end of file diff --git a/trixie/scripts/lib/constants_repopaths.sh b/trixie/scripts/lib/constants_repopaths.sh new file mode 120000 index 0000000..5072dd0 --- /dev/null +++ b/trixie/scripts/lib/constants_repopaths.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/constants_repopaths.sh \ No newline at end of file diff --git a/trixie/scripts/lib/constants_secrets b/trixie/scripts/lib/constants_secrets deleted file mode 100644 index 9b0cf7e..0000000 --- a/trixie/scripts/lib/constants_secrets +++ /dev/null @@ -1,9 +0,0 @@ -. lib/constants_user -PATH_MEDIA=/media -PATH_REL_SECRETS=.secrets -PATH_SECRETS="${PATH_USER_HOME}/${PATH_REL_SECRETS}" -PATH_SECRETS_SSH="${PATH_SECRETS}/ssh" -PATH_SECRETS_BORGKEYS="${PATH_SECRETS}/borgkeys" -FILENAME_KDBX=Passwords.kdbx -PATH_SECRETS_KDBX="${PATH_SECRETS}/${FILENAME_KDBX}" -PATH_USER_KDBX="${PATH_USER_HOME}/${FILENAME_KDBX}" diff --git a/trixie/scripts/lib/constants_secrets.sh b/trixie/scripts/lib/constants_secrets.sh new file mode 100644 index 0000000..4b19a02 --- /dev/null +++ b/trixie/scripts/lib/constants_secrets.sh @@ -0,0 +1,9 @@ +. lib/constants_user.sh +PATH_MEDIA=/media +PATH_REL_SECRETS=.secrets +PATH_SECRETS="${PATH_USER_HOME}/${PATH_REL_SECRETS}" +PATH_SECRETS_SSH="${PATH_SECRETS}/ssh" +PATH_SECRETS_BORGKEYS="${PATH_SECRETS}/borgkeys" +FILENAME_KDBX=Passwords.kdbx +PATH_SECRETS_KDBX="${PATH_SECRETS}/${FILENAME_KDBX}" +PATH_USER_KDBX="${PATH_USER_HOME}/${FILENAME_KDBX}" diff --git a/trixie/scripts/lib/constants_seedbox b/trixie/scripts/lib/constants_seedbox deleted file mode 120000 index 2b5a74d..0000000 --- a/trixie/scripts/lib/constants_seedbox +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/constants_seedbox \ No newline at end of file diff --git a/trixie/scripts/lib/constants_seedbox.sh b/trixie/scripts/lib/constants_seedbox.sh new file mode 120000 index 0000000..cd89783 --- /dev/null +++ b/trixie/scripts/lib/constants_seedbox.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/constants_seedbox.sh \ No newline at end of file diff --git a/trixie/scripts/lib/constants_ssh b/trixie/scripts/lib/constants_ssh deleted file mode 120000 index b711025..0000000 --- a/trixie/scripts/lib/constants_ssh +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/constants_ssh \ No newline at end of file diff --git a/trixie/scripts/lib/constants_ssh.sh b/trixie/scripts/lib/constants_ssh.sh new file mode 120000 index 0000000..aab9999 --- /dev/null +++ b/trixie/scripts/lib/constants_ssh.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/constants_ssh.sh \ No newline at end of file diff --git a/trixie/scripts/lib/constants_user b/trixie/scripts/lib/constants_user deleted file mode 120000 index 1e15899..0000000 --- a/trixie/scripts/lib/constants_user +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/constants_user \ No newline at end of file diff --git a/trixie/scripts/lib/constants_user.sh b/trixie/scripts/lib/constants_user.sh new file mode 120000 index 0000000..62c24f1 --- /dev/null +++ b/trixie/scripts/lib/constants_user.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/constants_user.sh \ No newline at end of file diff --git a/trixie/scripts/lib/copy_and_unmount_secrets b/trixie/scripts/lib/copy_and_unmount_secrets deleted file mode 100644 index 8d203c9..0000000 --- a/trixie/scripts/lib/copy_and_unmount_secrets +++ /dev/null @@ -1,18 +0,0 @@ -. lib/constants_secrets # PATH_REL_SECRETS, PATH_SECRETS - -copy_and_unmount_secrets() { -prefixed_msg_init copy_and_unmount_secrets - -prefixed_msg "Copying over ${PATH_REL_SECRETS}." -if [ "$1" = "out" ]; then - cp -a "${PATH_SECRETS}" "${PATH_MOUNTED_SECRETS}" -elif [ "$1" = "in" ]; then - cp -a "${PATH_MOUNTED_SECRETS}" "${PATH_SECRETS}" -else - abort "Illegal argument to unmount_secrets." -fi -pumount "${SECRETS_DEV}" -prefixed_msg "You can remove device ${SECRETS_DEV} now." - -prefixed_msg_exit -} diff --git a/trixie/scripts/lib/copy_and_unmount_secrets.sh b/trixie/scripts/lib/copy_and_unmount_secrets.sh new file mode 100644 index 0000000..6a29ebe --- /dev/null +++ b/trixie/scripts/lib/copy_and_unmount_secrets.sh @@ -0,0 +1,18 @@ +. lib/constants_secrets.sh # PATH_REL_SECRETS, PATH_SECRETS + +copy_and_unmount_secrets() { +prefixed_msg_init copy_and_unmount_secrets + +prefixed_msg "Copying over ${PATH_REL_SECRETS}." +if [ "$1" = "out" ]; then + cp -a "${PATH_SECRETS}" "${PATH_MOUNTED_SECRETS}" +elif [ "$1" = "in" ]; then + cp -a "${PATH_MOUNTED_SECRETS}" "${PATH_SECRETS}" +else + abort "Illegal argument to unmount_secrets." +fi +pumount "${SECRETS_DEV}" +prefixed_msg "You can remove device ${SECRETS_DEV} now." + +prefixed_msg_exit +} diff --git a/trixie/scripts/lib/copy_dirtrees_of_tags b/trixie/scripts/lib/copy_dirtrees_of_tags deleted file mode 120000 index d33a150..0000000 --- a/trixie/scripts/lib/copy_dirtrees_of_tags +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/copy_dirtrees_of_tags \ No newline at end of file diff --git a/trixie/scripts/lib/copy_dirtrees_of_tags.sh b/trixie/scripts/lib/copy_dirtrees_of_tags.sh new file mode 120000 index 0000000..3198848 --- /dev/null +++ b/trixie/scripts/lib/copy_dirtrees_of_tags.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/copy_dirtrees_of_tags.sh \ No newline at end of file diff --git a/trixie/scripts/lib/core_setup b/trixie/scripts/lib/core_setup deleted file mode 120000 index 74ac2dd..0000000 --- a/trixie/scripts/lib/core_setup +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/core_setup \ No newline at end of file diff --git a/trixie/scripts/lib/core_setup.sh b/trixie/scripts/lib/core_setup.sh new file mode 120000 index 0000000..da497f2 --- /dev/null +++ b/trixie/scripts/lib/core_setup.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/core_setup.sh \ No newline at end of file diff --git a/trixie/scripts/lib/ensure_packages_of_tags b/trixie/scripts/lib/ensure_packages_of_tags deleted file mode 120000 index 3c5fdf5..0000000 --- a/trixie/scripts/lib/ensure_packages_of_tags +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/ensure_packages_of_tags \ No newline at end of file diff --git a/trixie/scripts/lib/ensure_packages_of_tags.sh b/trixie/scripts/lib/ensure_packages_of_tags.sh new file mode 120000 index 0000000..ca07505 --- /dev/null +++ b/trixie/scripts/lib/ensure_packages_of_tags.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/ensure_packages_of_tags.sh \ No newline at end of file diff --git a/trixie/scripts/lib/expect_n_args b/trixie/scripts/lib/expect_n_args deleted file mode 120000 index 5c37e82..0000000 --- a/trixie/scripts/lib/expect_n_args +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/expect_n_args \ No newline at end of file diff --git a/trixie/scripts/lib/expect_n_args.sh b/trixie/scripts/lib/expect_n_args.sh new file mode 120000 index 0000000..7430ba5 --- /dev/null +++ b/trixie/scripts/lib/expect_n_args.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/expect_n_args.sh \ No newline at end of file diff --git a/trixie/scripts/lib/expected_rtorrent_files b/trixie/scripts/lib/expected_rtorrent_files deleted file mode 120000 index 04bc8a5..0000000 --- a/trixie/scripts/lib/expected_rtorrent_files +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/expected_rtorrent_files \ No newline at end of file diff --git a/trixie/scripts/lib/expected_rtorrent_files.sh b/trixie/scripts/lib/expected_rtorrent_files.sh new file mode 120000 index 0000000..3b830e9 --- /dev/null +++ b/trixie/scripts/lib/expected_rtorrent_files.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/expected_rtorrent_files.sh \ No newline at end of file diff --git a/trixie/scripts/lib/for_line_in b/trixie/scripts/lib/for_line_in deleted file mode 120000 index be20aa1..0000000 --- a/trixie/scripts/lib/for_line_in +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/for_line_in \ No newline at end of file diff --git a/trixie/scripts/lib/for_line_in.sh b/trixie/scripts/lib/for_line_in.sh new file mode 120000 index 0000000..08d5094 --- /dev/null +++ b/trixie/scripts/lib/for_line_in.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/for_line_in.sh \ No newline at end of file diff --git a/trixie/scripts/lib/get_mountable_device_path b/trixie/scripts/lib/get_mountable_device_path deleted file mode 100644 index b0a1cd5..0000000 --- a/trixie/scripts/lib/get_mountable_device_path +++ /dev/null @@ -1,11 +0,0 @@ -. lib/abort - -get_mountable_device_path() { - _PATH_DEV="/dev/$1" - if [ ! -b "${_PATH_DEV}" ]; then - abort "No block device at ${_PATH_DEV}." - elif [ $(mount | grep -E "^${_PATH_DEV}" | wc -l) -gt 0 ]; then - abort "${_PATH_DEV} already mounted." - fi - printf "${_PATH_DEV}" -} diff --git a/trixie/scripts/lib/get_mountable_device_path.sh b/trixie/scripts/lib/get_mountable_device_path.sh new file mode 100644 index 0000000..8af2a89 --- /dev/null +++ b/trixie/scripts/lib/get_mountable_device_path.sh @@ -0,0 +1,11 @@ +. lib/abort.sh + +get_mountable_device_path() { + _PATH_DEV="/dev/$1" + if [ ! -b "${_PATH_DEV}" ]; then + abort "No block device at ${_PATH_DEV}." + elif [ $(mount | grep -E "^${_PATH_DEV}" | wc -l) -gt 0 ]; then + abort "${_PATH_DEV} already mounted." + fi + printf "${_PATH_DEV}" +} diff --git a/trixie/scripts/lib/get_passphrase b/trixie/scripts/lib/get_passphrase deleted file mode 100644 index 6e3f0ff..0000000 --- a/trixie/scripts/lib/get_passphrase +++ /dev/null @@ -1,6 +0,0 @@ -get_passphrase() { - stty -echo - read PASSPHRASE - stty echo - printf "${PASSPHRASE}" -} diff --git a/trixie/scripts/lib/get_passphrase.sh b/trixie/scripts/lib/get_passphrase.sh new file mode 100644 index 0000000..6e3f0ff --- /dev/null +++ b/trixie/scripts/lib/get_passphrase.sh @@ -0,0 +1,6 @@ +get_passphrase() { + stty -echo + read PASSPHRASE + stty echo + printf "${PASSPHRASE}" +} diff --git a/trixie/scripts/lib/install_tags b/trixie/scripts/lib/install_tags deleted file mode 120000 index e205175..0000000 --- a/trixie/scripts/lib/install_tags +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/install_tags \ No newline at end of file diff --git a/trixie/scripts/lib/install_tags.sh b/trixie/scripts/lib/install_tags.sh new file mode 120000 index 0000000..965dd4a --- /dev/null +++ b/trixie/scripts/lib/install_tags.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/install_tags.sh \ No newline at end of file diff --git a/trixie/scripts/lib/mount_secrets b/trixie/scripts/lib/mount_secrets deleted file mode 100644 index 7012dab..0000000 --- a/trixie/scripts/lib/mount_secrets +++ /dev/null @@ -1,29 +0,0 @@ -. lib/constants_secrets # PATH_MEDIA, PATH_REL_SECRETS -. lib/expect_n_args -. lib/get_passphrase -. lib/path_tmp_timestamped -. lib/prefixed_msg -. lib/retry_until - -mount_secrets() { -prefixed_msg_init mount_secrets - -SECRETS_DEV=$1 -if [ -z "${SECRETS_DEV}" ]; then - abort "Aborting due to empty device argument." -fi -PATH_MOUNTED_SECRETS="${PATH_MEDIA}/${SECRETS_DEV}/${PATH_REL_SECRETS}" -PATH_DEV="/dev/${SECRETS_DEV}" -PATH_PMOUNT_ERR="$(path_tmp_timestamped 'err_mount')" -prefixed_msg "Put secrets drive into slot for ${PATH_DEV}." -while [ ! -e "${PATH_DEV}" ]; do - sleep 0.1 -done -_ON_LOOP_START='prefixed_msg_no_nl "Passphrase: "; PASSPHRASE=$(get_passphrase); echo ""' -_TO_TEST='echo "${PASSPHRASE}" | pmount "${PATH_DEV}" 2>&1' -_ON_FAIL='prefixed_msg "Aborting due to pmount error:"' -retry_until 100 "${_ON_LOOP_START}" "${_TO_TEST}" "${_ON_FAIL}" -prefixed_msg "${_OUTPUT}" - -prefixed_msg_exit -} diff --git a/trixie/scripts/lib/mount_secrets.sh b/trixie/scripts/lib/mount_secrets.sh new file mode 100644 index 0000000..679d4c2 --- /dev/null +++ b/trixie/scripts/lib/mount_secrets.sh @@ -0,0 +1,29 @@ +. lib/constants_secrets.sh # PATH_MEDIA, PATH_REL_SECRETS +. lib/expect_n_args.sh +. lib/get_passphrase.sh +. lib/path_tmp_timestamped.sh +. lib/prefixed_msg.sh +. lib/retry_until.sh + +mount_secrets() { +prefixed_msg_init mount_secrets + +SECRETS_DEV=$1 +if [ -z "${SECRETS_DEV}" ]; then + abort "Aborting due to empty device argument." +fi +PATH_MOUNTED_SECRETS="${PATH_MEDIA}/${SECRETS_DEV}/${PATH_REL_SECRETS}" +PATH_DEV="/dev/${SECRETS_DEV}" +PATH_PMOUNT_ERR="$(path_tmp_timestamped 'err_mount')" +prefixed_msg "Put secrets drive into slot for ${PATH_DEV}." +while [ ! -e "${PATH_DEV}" ]; do + sleep 0.1 +done +_ON_LOOP_START='prefixed_msg_no_nl "Passphrase: "; PASSPHRASE=$(get_passphrase); echo ""' +_TO_TEST='echo "${PASSPHRASE}" | pmount "${PATH_DEV}" 2>&1' +_ON_FAIL='prefixed_msg "Aborting due to pmount error:"' +retry_until 100 "${_ON_LOOP_START}" "${_TO_TEST}" "${_ON_FAIL}" +prefixed_msg "${_OUTPUT}" + +prefixed_msg_exit +} diff --git a/trixie/scripts/lib/path_tmp_timestamped b/trixie/scripts/lib/path_tmp_timestamped deleted file mode 100644 index 7ae63cd..0000000 --- a/trixie/scripts/lib/path_tmp_timestamped +++ /dev/null @@ -1,3 +0,0 @@ -path_tmp_timestamped () { - printf "/tmp/${1}_$(date +'%s')" -} diff --git a/trixie/scripts/lib/path_tmp_timestamped.sh b/trixie/scripts/lib/path_tmp_timestamped.sh new file mode 100644 index 0000000..7ae63cd --- /dev/null +++ b/trixie/scripts/lib/path_tmp_timestamped.sh @@ -0,0 +1,3 @@ +path_tmp_timestamped () { + printf "/tmp/${1}_$(date +'%s')" +} diff --git a/trixie/scripts/lib/prefixed_msg b/trixie/scripts/lib/prefixed_msg deleted file mode 120000 index 2caf5d7..0000000 --- a/trixie/scripts/lib/prefixed_msg +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/prefixed_msg \ No newline at end of file diff --git a/trixie/scripts/lib/prefixed_msg.sh b/trixie/scripts/lib/prefixed_msg.sh new file mode 120000 index 0000000..28dd87f --- /dev/null +++ b/trixie/scripts/lib/prefixed_msg.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/prefixed_msg.sh \ No newline at end of file diff --git a/trixie/scripts/lib/put_finished_marker b/trixie/scripts/lib/put_finished_marker deleted file mode 120000 index 54b6550..0000000 --- a/trixie/scripts/lib/put_finished_marker +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/put_finished_marker \ No newline at end of file diff --git a/trixie/scripts/lib/put_finished_marker.sh b/trixie/scripts/lib/put_finished_marker.sh new file mode 120000 index 0000000..ec16395 --- /dev/null +++ b/trixie/scripts/lib/put_finished_marker.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/put_finished_marker.sh \ No newline at end of file diff --git a/trixie/scripts/lib/retry_until b/trixie/scripts/lib/retry_until deleted file mode 100644 index 5179ba1..0000000 --- a/trixie/scripts/lib/retry_until +++ /dev/null @@ -1,27 +0,0 @@ -retry_until() { - _CODE_FOR_CONTINUE="$1" - _ON_LOOP_START="$2" - _TO_TEST="$3" - _ON_FAIL="$4" - _ON_LOOP_END="$5" - _OUTPUT_MODE="$6" - while true; do - eval "${_ON_LOOP_START}" - set +e - if [ "${_OUTPUT_MODE}" = 'direct' ]; then - eval ${_TO_TEST} - _RESULT=$? - else - _OUTPUT="$(eval ${_TO_TEST})" - _RESULT=$? - fi - set -e - if [ "${_RESULT}" = '0' ]; then - break - elif [ "${_RESULT}" != "${_CODE_FOR_CONTINUE}" ]; then - eval "${_ON_FAIL}" - abort - fi - eval "${_ON_LOOP_END}" - done -} diff --git a/trixie/scripts/lib/retry_until.sh b/trixie/scripts/lib/retry_until.sh new file mode 100644 index 0000000..5179ba1 --- /dev/null +++ b/trixie/scripts/lib/retry_until.sh @@ -0,0 +1,27 @@ +retry_until() { + _CODE_FOR_CONTINUE="$1" + _ON_LOOP_START="$2" + _TO_TEST="$3" + _ON_FAIL="$4" + _ON_LOOP_END="$5" + _OUTPUT_MODE="$6" + while true; do + eval "${_ON_LOOP_START}" + set +e + if [ "${_OUTPUT_MODE}" = 'direct' ]; then + eval ${_TO_TEST} + _RESULT=$? + else + _OUTPUT="$(eval ${_TO_TEST})" + _RESULT=$? + fi + set -e + if [ "${_RESULT}" = '0' ]; then + break + elif [ "${_RESULT}" != "${_CODE_FOR_CONTINUE}" ]; then + eval "${_ON_FAIL}" + abort + fi + eval "${_ON_LOOP_END}" + done +} diff --git a/trixie/scripts/lib/tagdir_parsing b/trixie/scripts/lib/tagdir_parsing deleted file mode 120000 index b86b7fa..0000000 --- a/trixie/scripts/lib/tagdir_parsing +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/tagdir_parsing \ No newline at end of file diff --git a/trixie/scripts/lib/tagdir_parsing.sh b/trixie/scripts/lib/tagdir_parsing.sh new file mode 120000 index 0000000..faf7a3c --- /dev/null +++ b/trixie/scripts/lib/tagdir_parsing.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/tagdir_parsing.sh \ No newline at end of file diff --git a/trixie/scripts/lib/trapp b/trixie/scripts/lib/trapp deleted file mode 120000 index 5833d35..0000000 --- a/trixie/scripts/lib/trapp +++ /dev/null @@ -1 +0,0 @@ -../../../bookworm/scripts/lib/trapp \ No newline at end of file diff --git a/trixie/scripts/lib/trapp.sh b/trixie/scripts/lib/trapp.sh new file mode 120000 index 0000000..23d49a5 --- /dev/null +++ b/trixie/scripts/lib/trapp.sh @@ -0,0 +1 @@ +../../../bookworm/scripts/lib/trapp.sh \ No newline at end of file diff --git a/trixie/scripts/make_writable_installer.sh b/trixie/scripts/make_writable_installer.sh index bd04512..dc8dedd 100755 --- a/trixie/scripts/make_writable_installer.sh +++ b/trixie/scripts/make_writable_installer.sh @@ -2,16 +2,16 @@ # based on set -eu cd $(dirname "$0") -. lib/INSTALLER_VERSION -. lib/abort -. lib/abort_if_command_unknown -. lib/abort_if_not_user -. lib/abort_if_offline -. lib/constants_installer # FILENAME_PRESEED_CFG, PATH_PRESEED_CFG -. lib/expect_n_args -. lib/get_mountable_device_path -. lib/path_tmp_timestamped -. lib/trapp +. lib/INSTALLER_VERSION.sh +. lib/abort.sh +. lib/abort_if_command_unknown.sh +. lib/abort_if_not_user.sh +. lib/abort_if_offline.sh +. lib/constants_installer.sh # FILENAME_PRESEED_CFG, PATH_PRESEED_CFG +. lib/expect_n_args.sh +. lib/get_mountable_device_path.sh +. lib/path_tmp_timestamped.sh +. lib/trapp.sh expect_n_args 1 2 'DEVICE (e.g. "sdb") [PATH_FILE_ISO]' $@ abort_if_not_user root diff --git a/trixie/scripts/setup_desktop.sh b/trixie/scripts/setup_desktop.sh index 9e95dae..d4062ba 100755 --- a/trixie/scripts/setup_desktop.sh +++ b/trixie/scripts/setup_desktop.sh @@ -2,16 +2,16 @@ set -eu ROOT=$(dirname "$0") cd "${ROOT}" -. lib/abort -. lib/abort_if_offline -. lib/apt_get_digested -. lib/constants_etc # PATH_ETC -. lib/constants_user # USERNAME -. lib/copy_dirtrees_of_tags -. lib/core_setup -. lib/expect_n_args -. lib/prefixed_msg -. lib/put_finished_marker +. lib/abort.sh +. lib/abort_if_offline.sh +. lib/apt_get_digested.sh +. lib/constants_etc.sh # PATH_ETC +. lib/constants_user.sh # USERNAME +. lib/copy_dirtrees_of_tags.sh +. lib/core_setup.sh +. lib/expect_n_args.sh +. lib/prefixed_msg.sh +. lib/put_finished_marker.sh prefixed_msg_init prefixed_msg 'starting …' diff --git a/trixie/scripts/setup_reform_qemu.sh b/trixie/scripts/setup_reform_qemu.sh index 025f2b8..b2a74cb 100755 --- a/trixie/scripts/setup_reform_qemu.sh +++ b/trixie/scripts/setup_reform_qemu.sh @@ -1,11 +1,11 @@ #!/bin/sh set -e cd $(dirname "$0") -. lib/apt_get_digested -. lib/constants_ssh # PATH_REL_SSH, PATH_USER_SSH -. lib/core_setup -. lib/expect_n_args -. lib/prefixed_msg +. lib/apt_get_digested.sh +. lib/constants_ssh.sh # PATH_REL_SSH, PATH_USER_SSH +. lib/core_setup.sh +. lib/expect_n_args.sh +. lib/prefixed_msg.sh prefixed_msg_init prefixed_msg 'starting' diff --git a/trixie/scripts/setup_secrets.sh b/trixie/scripts/setup_secrets.sh index f50ed96..f40f720 100755 --- a/trixie/scripts/setup_secrets.sh +++ b/trixie/scripts/setup_secrets.sh @@ -1,12 +1,12 @@ #!/bin/sh set -e cd $(dirname "$0") -. lib/abort_if_not_user -. lib/check_finished_marker -. lib/constants_repopaths # PATH_CONF, PATH_SCRIPTS -. lib/constants_user # USERNAME -. lib/path_tmp_timestamped -. lib/prefixed_msg +. lib/abort_if_not_user.sh +. lib/check_finished_marker.sh +. lib/constants_repopaths.sh # PATH_CONF, PATH_SCRIPTS +. lib/constants_user.sh # USERNAME +. lib/path_tmp_timestamped.sh +. lib/prefixed_msg.sh prefixed_msg_init diff --git a/trixie/scripts/update_preseed.sh b/trixie/scripts/update_preseed.sh index 743bb5c..e23c201 100755 --- a/trixie/scripts/update_preseed.sh +++ b/trixie/scripts/update_preseed.sh @@ -1,12 +1,12 @@ #!/bin/sh set -e cd $(dirname "$0") -. lib/abort_if_command_unknown -. lib/constants_installer # FILENAME_PRESEED_CFG, PATH_PRESEED_CFG -. lib/expect_n_args -. lib/get_mountable_device_path -. lib/prefixed_msg -. lib/trapp +. lib/abort_if_command_unknown.sh +. lib/constants_installer.sh # FILENAME_PRESEED_CFG, PATH_PRESEED_CFG +. lib/expect_n_args.sh +. lib/get_mountable_device_path.sh +. lib/prefixed_msg.sh +. lib/trapp.sh prefixed_msg_init