From ed1396e7c1f7cea84adb213262726b8a9f87edff Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Tue, 6 May 2025 05:01:45 +0200 Subject: [PATCH] Fix. --- bookworm/scripts/lib/apt_get_digested | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/bookworm/scripts/lib/apt_get_digested b/bookworm/scripts/lib/apt_get_digested index 67cbccb..34ac00f 100644 --- a/bookworm/scripts/lib/apt_get_digested +++ b/bookworm/scripts/lib/apt_get_digested @@ -3,10 +3,8 @@ apt_get_digested() { prefixed_msg_init 'apt_get_digested' - abort_if_command_unknown calc -_FINISH_LINE='apt_get_digested_FINISH_LINE' _SEDS=\ '|\(Reading database \.\.\. .*|IGNORE |Generation complete.|IGNORE @@ -31,15 +29,21 @@ BECOME_NEXT_PREFIX|dpkg: ([[:print:]]+): dependency problems, but removing anywa 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)]' +_FINISH_LINE='apt_get_digested_FINISH_LINE' _LAST_PREFIX='' _STARTED_PRINTING= +print_cr_and_if_started_printing_nl() { + printf '\r' + if [ ! -z "${_STARTED_PRINTING}" ]; then + printf '\n' + fi +} eval "DEBIAN_FRONTEND=noninteractive apt-get -y $1; echo ${_FINISH_LINE}" 2>&1 | while read _LINE; do _LINE=$(printf '%s' "${_LINE}" | tr -d '\r') if [ -z "${_LINE}" ]; then continue elif [ "${_LINE}" = "${_FINISH_LINE}" ]; then - test ! -z "${_STARTED_PRINTING}" && printf '\n' - printf '\r' + print_cr_and_if_started_printing_nl() break fi _COMPRESSED_ITEM='' @@ -62,13 +66,12 @@ eval "DEBIAN_FRONTEND=noninteractive apt-get -y $1; echo ${_FINISH_LINE}" 2>&1 | if [ "${_COMPRESSED_ITEM}" = "IGNORE" ]; then continue elif [ -z "${_COMPRESSED_ITEM}" ]; then - test ! -z "${_STARTED_PRINTING}" && printf '\n' - printf '\r%s' "${_LINE}" + print_cr_and_if_started_printing_nl() + printf '%s' "${_LINE}" _LAST_PREFIX='' else if [ "${_PREFIX}" != "${_LAST_PREFIX}" ]; then - test ! -z "${_STARTED_PRINTING}" && printf '\n' - printf '\r' + print_cr_and_if_started_printing_nl() prefixed_msg_no_nl "${_PREFIX}" _LAST_PREFIX="${_PREFIX}" fi -- 2.30.2