From 320c517d94f902938e41c4628f072b5c1d941f25 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Tue, 6 May 2025 05:05:52 +0200 Subject: [PATCH] Fix. --- bookworm/scripts/lib/apt_get_digested | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/bookworm/scripts/lib/apt_get_digested b/bookworm/scripts/lib/apt_get_digested index 49a30c6..67cbccb 100644 --- a/bookworm/scripts/lib/apt_get_digested +++ b/bookworm/scripts/lib/apt_get_digested @@ -3,8 +3,10 @@ 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 @@ -29,21 +31,15 @@ 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() { - if [ ! -z "${_STARTED_PRINTING}" ]; then - printf '\n' - fi - printf '\r' -} 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 - print_cr_and_if_started_printing_nl() + test ! -z "${_STARTED_PRINTING}" && printf '\n' + printf '\r' break fi _COMPRESSED_ITEM='' @@ -66,12 +62,13 @@ eval "DEBIAN_FRONTEND=noninteractive apt-get -y $1; echo ${_FINISH_LINE}" 2>&1 | if [ "${_COMPRESSED_ITEM}" = "IGNORE" ]; then continue elif [ -z "${_COMPRESSED_ITEM}" ]; then - print_cr_and_if_started_printing_nl() - printf '%s' "${_LINE}" + test ! -z "${_STARTED_PRINTING}" && printf '\n' + printf '\r%s' "${_LINE}" _LAST_PREFIX='' else if [ "${_PREFIX}" != "${_LAST_PREFIX}" ]; then - print_cr_and_if_started_printing_nl() + test ! -z "${_STARTED_PRINTING}" && printf '\n' + printf '\r' prefixed_msg_no_nl "${_PREFIX}" _LAST_PREFIX="${_PREFIX}" fi -- 2.30.2