From: Christian Heller Date: Mon, 5 May 2025 20:13:54 +0000 (+0200) Subject: Fixed. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/calendar?a=commitdiff_plain;h=9e7aa69b58b23a61d8ce60c5a9a6f6bc0f0a6b99;p=config Fixed. --- diff --git a/bookworm/scripts/lib/apt_get_digested b/bookworm/scripts/lib/apt_get_digested new file mode 100644 index 0000000..c1c7f02 --- /dev/null +++ b/bookworm/scripts/lib/apt_get_digested @@ -0,0 +1,67 @@ +. lib/abort_if_command_unknown +apt_get_digested() { + +abort_if_command_unknown calc + +_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: despite dependency problems, removing \1 – dependencies: +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)]' + +_LAST_PREFIX='' +DEBIAN_FRONTEND=noninteractive apt-get -y $1 2>&1 | while read _LINE; do + _LINE=$(printf '%s' "${_LINE}" | tr -d '\r') + if [ -z "${_LINE}" ]; then + continue + fi + _COMPRESSED_ITEM='' + for _SED in $(printf '%s' "${_SEDS}" | sed 's/ /#WHITESPACE#/g'); do + _WHITESPACED=$(printf '%s' "${_SED}" | sed 's/#WHITESPACE#/ /g') + _PREFIX=$(printf '%s' "${_WHITESPACED}" | cut -d'|' -f1) + _PATTERN=$(printf '^%s$' "${_WHITESPACED}" | cut -d'|' -f2) + _REPLACEMENT=$(printf '%s' "${_WHITESPACED}" | cut -d'|' -f3) + if printf '%s' "${_LINE}" | grep -E "${_PATTERN}" > /dev/null; then + _COMPRESSED_ITEM=$(printf '%s' "${_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 + done + if [ "${_COMPRESSED_ITEM}" = "IGNORE" ]; then + continue + elif [ -z "${_COMPRESSED_ITEM}" ]; then + _LAST_PREFIX='' + printf '\n\r%s' "${_LINE}" + else + if [ "${_PREFIX}" != "${_LAST_PREFIX}" ]; then + printf '\n\r# apt_get_digested: %s' "${_PREFIX}" + _LAST_PREFIX="${_PREFIX}" + fi + printf ' %s' "${_COMPRESSED_ITEM}" + fi +done +printf '\r\n\n' +} diff --git a/bookworm/scripts/lib/apt_get_edited b/bookworm/scripts/lib/apt_get_edited deleted file mode 100644 index 960e4ff..0000000 --- a/bookworm/scripts/lib/apt_get_edited +++ /dev/null @@ -1,67 +0,0 @@ -. lib/abort_if_command_unknown -apt_get_edited() { - -abort_if_command_unknown calc - -_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: despite dependency problems, removing \1 – dependencies: -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)]' - -_LAST_PREFIX='' -DEBIAN_FRONTEND=noninteractive apt-get -y $1 2>&1 | while read _LINE; do - _LINE=$(printf '%s' "${_LINE}" | tr -d '\r') - if [ -z "${_LINE}" ]; then - continue - fi - _COMPRESSED_ITEM='' - for _SED in $(printf '%s' "${_SEDS}" | sed 's/ /#WHITESPACE#/g'); do - _WHITESPACED=$(printf '%s' "${_SED}" | sed 's/#WHITESPACE#/ /g') - _PREFIX=$(printf '%s' "${_WHITESPACED}" | cut -d'|' -f1) - _PATTERN=$(printf '^%s$' "${_WHITESPACED}" | cut -d'|' -f2) - _REPLACEMENT=$(printf '%s' "${_WHITESPACED}" | cut -d'|' -f3) - if printf '%s' "${_LINE}" | grep -E "${_PATTERN}" > /dev/null; then - _COMPRESSED_ITEM=$(printf '%s' "${_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 - done - if [ "${_COMPRESSED_ITEM}" = "IGNORE" ]; then - continue - elif [ -z "${_COMPRESSED_ITEM}" ]; then - _LAST_PREFIX='' - printf '\n\r%s' "${_LINE}" - else - if [ "${_PREFIX}" != "${_LAST_PREFIX}" ]; then - printf '\n\r# apt_get_edited: %s' "${_PREFIX}" - _LAST_PREFIX="${_PREFIX}" - fi - printf ' %s' "${_COMPRESSED_ITEM}" - fi -done -printf '\r\n\n' -} diff --git a/bookworm/scripts/lib/core_setup b/bookworm/scripts/lib/core_setup index 9c3ace4..c612544 100644 --- a/bookworm/scripts/lib/core_setup +++ b/bookworm/scripts/lib/core_setup @@ -1,3 +1,4 @@ +. lib/apt_get_digested . lib/constants_user # USERNAME . lib/copy_dirtrees_of_tags . lib/minimize_installation @@ -14,7 +15,7 @@ _INSTALL_TAGS="$4" minimize_installation ${_INSTALL_TAGS} prefixed_msg 'And now: dist-upgrade …' -apt_get_edited '-q -q dist-upgrade' +apt_get_digested '-q -q dist-upgrade' prefixed_msg "Setting up user: ${USERNAME}" adduser --quiet --disabled-password --gecos "" "${USERNAME}" diff --git a/bookworm/scripts/lib/ensure_packages_of_tags b/bookworm/scripts/lib/ensure_packages_of_tags index 941e262..4bcdace 100644 --- a/bookworm/scripts/lib/ensure_packages_of_tags +++ b/bookworm/scripts/lib/ensure_packages_of_tags @@ -1,4 +1,4 @@ -. lib/apt_get_edited +. lib/apt_get_digested . lib/prefixed_msg ensure_packages_of_tags() { prefixed_msg_init '# ensure_packages_of_tags: ' @@ -15,7 +15,7 @@ for _TAG in $@; do echo "nothing to install." else echo "ensuring installation of: ${_PACKAGES}" - apt_get_edited "-q -q -o Dpkg::Options::=--force-confnew install ${_PACKAGES}" + apt_get_digested "-q -q -o Dpkg::Options::=--force-confnew install ${_PACKAGES}" fi done prefixed_msg 'finished' diff --git a/bookworm/scripts/lib/minimize_installation b/bookworm/scripts/lib/minimize_installation index 7c993d2..366625a 100644 --- a/bookworm/scripts/lib/minimize_installation +++ b/bookworm/scripts/lib/minimize_installation @@ -1,4 +1,4 @@ -. lib/apt_get_edited +. lib/apt_get_digested . lib/ensure_packages_of_tags . lib/prefixed_msg minimize_installation() { @@ -37,7 +37,7 @@ prefixed_msg 'install or mark as manually installed packages from our own select ensure_packages_of_tags ${_INSTALL_TAGS} prefixed_msg 'run autopurge to get rid of all unwanted packages …' -apt_get_edited '-q -q autopurge' +apt_get_digested '-q -q autopurge' prefixed_msg 'finished' prefixed_msg_exit diff --git a/bookworm/scripts/lib/prefixed_msg b/bookworm/scripts/lib/prefixed_msg index b1b32fc..dcb9264 100644 --- a/bookworm/scripts/lib/prefixed_msg +++ b/bookworm/scripts/lib/prefixed_msg @@ -1,9 +1,10 @@ prefixed_msg_init() { - prefixed_msg_OLD_PREFIX="${prefixed_msg_PREFIX}" + prefixed_msg_OLD_PREFIX="${prefixed_msg_PREFIX}|${prefixed_msg_OLD_PREFIX}" prefixed_msg_PREFIX="$1" } prefixed_msg_exit() { - prefixed_msg_PREFIX="${prefixed_msg_OLD_PREFIX}" + prefixed_msg_PREFIX=$(echo "${prefixed_msg_OLD_PREFIX}" | cut -d'|' -f1) + prefixed_msg_OLD_PREFIX=$(echo "${prefixed_msg_OLD_PREFIX}" | cut -d'|' -f2-) } prefixed_msg() { printf '%s%s\n' "${prefixed_msg_PREFIX}" "$1" diff --git a/testing/scripts/lib/apt_get_edited b/testing/scripts/lib/apt_get_edited deleted file mode 120000 index 82f1893..0000000 --- a/testing/scripts/lib/apt_get_edited +++ /dev/null @@ -1 +0,0 @@ -../../../trixie/scripts/lib/apt_get_edited \ No newline at end of file