home · contact · privacy
Fix.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 6 May 2025 03:18:15 +0000 (05:18 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 6 May 2025 03:18:15 +0000 (05:18 +0200)
bookworm/scripts/lib/apt_get_digested

index 67cbccb34ca7bdbdef6199d3469d331d99fe02d7..e0542f13036f342ddaa08a119f3d7b6f4363529a 100644 (file)
@@ -31,6 +31,11 @@ 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)]'
 
+print_nl_if_started_printing() {
+    if [ ! -z "${_STARTED_PRINTING}" ]; then
+        printf '\n'
+    fi
+}
 _LAST_PREFIX=''
 _STARTED_PRINTING=
 eval "DEBIAN_FRONTEND=noninteractive apt-get -y $1; echo ${_FINISH_LINE}" 2>&1 | while read _LINE; do
@@ -38,7 +43,7 @@ eval "DEBIAN_FRONTEND=noninteractive apt-get -y $1; echo ${_FINISH_LINE}" 2>&1 |
     if [ -z "${_LINE}" ]; then
         continue
     elif [ "${_LINE}" = "${_FINISH_LINE}" ]; then
-        test ! -z "${_STARTED_PRINTING}" && printf '\n'
+        print_nl_if_started_printing
         printf '\r'
         break
     fi
@@ -62,12 +67,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'
+        print_nl_if_started_printing
         printf '\r%s' "${_LINE}"
         _LAST_PREFIX=''
     else
         if [ "${_PREFIX}" != "${_LAST_PREFIX}" ]; then
-            test ! -z "${_STARTED_PRINTING}" && printf '\n'
+            print_nl_if_started_printing
             printf '\r'
             prefixed_msg_no_nl "${_PREFIX}"
             _LAST_PREFIX="${_PREFIX}"