From e11f7068b8323cec4e503141eb41e64be8802c55 Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Sun, 19 Nov 2023 01:35:54 -0500 Subject: [PATCH 01/16] improve error handling for EFI uuid --- chroot-script | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chroot-script b/chroot-script index 1602f6d..e036912 100755 --- a/chroot-script +++ b/chroot-script @@ -495,8 +495,8 @@ EOF fi if [ -n "$EFI" ] ; then - # shellcheck disable=SC2086 - echo "UUID=$(blkid -o value -s UUID $EFI) /boot/efi vfat umask=0077 0 1" >> /etc/fstab + UUID_EFI="$(blkid -o value -s UUID "$EFI")" + echo "UUID=$UUID_EFI /boot/efi vfat umask=0077 0 1" >> /etc/fstab fi cat >> /etc/fstab << EOF -- 2.1.4 From 7a3f1d98d277b653f646ed48b87e7d61793b0cad Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Wed, 22 Nov 2023 00:54:15 -0500 Subject: [PATCH 02/16] not enabling stretch security repository because no longer provided by Debian --- chroot-script | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chroot-script b/chroot-script index e036912..fafe1bf 100755 --- a/chroot-script +++ b/chroot-script @@ -104,8 +104,8 @@ chrootmirror() { # add security.debian.org: case "$RELEASE" in - unstable|sid) ;; # no security pool available - jessie|stretch|buster) + unstable|sid|stretch) ;; # no security pool available + jessie|buster) echo "Adding security.debian.org to sources.list." echo "deb http://security.debian.org ${RELEASE}/updates $COMPONENTS" >> /etc/apt/sources.list ;; -- 2.1.4 From 14e8a829e40f2ed801a05b783507e3feb0e005fc Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Mon, 11 Dec 2023 11:23:12 -0500 Subject: [PATCH 03/16] style fix: always use "${MNTPOINT}"/boot/efi instead of sometimes mixed with "${MNTPOINT}/boot/efi" --- grml-debootstrap | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/grml-debootstrap b/grml-debootstrap index 3c6ef2f..037e83b 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -252,7 +252,7 @@ cleanup() { fi if [ -n "$ARM_EFI_TARGET" ]; then - umount "${MNTPOINT}/boot/efi" >/dev/null 2>&1 + umount "${MNTPOINT}"/boot/efi fi # Remove temporary mountpoint again @@ -1548,8 +1548,8 @@ grub_install() { fi if [ -n "${ARM_EFI_TARGET}" ]; then - mkdir -p "${MNTPOINT}/boot/efi" - if ! mount "${ARM_EFI_TARGET}" "${MNTPOINT}/boot/efi" ; then + mkdir -p "${MNTPOINT}"/boot/efi + if ! mount "${ARM_EFI_TARGET}" "${MNTPOINT}"/boot/efi ; then eerror "Error: Mounting ${ARM_EFI_TARGET} failed, can not continue." bailout 1 fi @@ -1696,7 +1696,7 @@ umount_target() { fi if [ -n "${ARM_EFI_TARGET}" ]; then - umount "${MNTPOINT}/boot/efi" + umount "${MNTPOINT}"/boot/efi fi umount "${MNTPOINT}" -- 2.1.4 From cc891dfa8fa1f950c3ac006351c19a80352c8155 Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Mon, 11 Dec 2023 11:39:38 -0500 Subject: [PATCH 04/16] fix error handling for unmounting on the arm64 architecture --- grml-debootstrap | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grml-debootstrap b/grml-debootstrap index 037e83b..879d105 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -251,7 +251,7 @@ cleanup() { einfo "Removing ${STAGES}" ; rmdir "$STAGES" || eend $? fi - if [ -n "$ARM_EFI_TARGET" ]; then + if findmnt "${MNTPOINT}"/boot/efi &>/dev/null ; then umount "${MNTPOINT}"/boot/efi fi @@ -1682,7 +1682,7 @@ grub_install() { umount "${MNTPOINT}"/dev/pts try_umount 3 "${MNTPOINT}"/dev - if [ -n "$VMEFI" ]; then + if findmnt "${MNTPOINT}"/boot/efi &>/dev/null ; then umount "${MNTPOINT}"/boot/efi fi @@ -1695,7 +1695,7 @@ umount_target() { return 0 fi - if [ -n "${ARM_EFI_TARGET}" ]; then + if findmnt "${MNTPOINT}"/boot/efi &>/dev/null ; then umount "${MNTPOINT}"/boot/efi fi -- 2.1.4 From 81d75876b9d20939a947557d1bde9bfe6fd77f38 Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Tue, 12 Dec 2023 11:23:45 -0500 Subject: [PATCH 05/16] consistently use ESP label for the EFI system partition change from EFI to ESP for arm64 builds --- grml-debootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grml-debootstrap b/grml-debootstrap index 0489c52..3e6ef66 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -1517,7 +1517,7 @@ prepare_vm() { if [ "$ARCH" = 'arm64' ]; then einfo "Setting up GPT partitions for arm64" parted -s "${TARGET}" 'mklabel gpt' - parted -s "${TARGET}" 'mkpart EFI fat32 1MiB 10MiB' + parted -s "${TARGET}" 'mkpart ESP fat32 1MiB 10MiB' parted -s "${TARGET}" 'set 1 boot on' parted -s "${TARGET}" 'mkpart LINUX ext4 10MiB 100%' else -- 2.1.4 From 19dc059a0f67699116d83305ce8f0320ef0fe613 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 22 Dec 2023 17:13:02 +0100 Subject: [PATCH 06/16] coding style: use '[' instead of 'test' --- grml-debootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grml-debootstrap b/grml-debootstrap index 879d105..d671de8 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -299,7 +299,7 @@ cleanup() { # remove directory only if we used the default with process id inside the name if echo "$MNTPOINT" | grep -q '/mnt/debootstrap\.' ; then - if test -d "$MNTPOINT" ; then + if [ -d "$MNTPOINT" ] ; then einfo "Removing directory ${MNTPOINT}" rmdir "$MNTPOINT" || eend $? fi -- 2.1.4 From 325a888abac1b26290c59b2f975cdf93ce7f3297 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 22 Dec 2023 17:21:28 +0100 Subject: [PATCH 07/16] Install busybox On Debian/stretch as it's required for initramfs Followup fix for 2708f441697d1b9 Thanks: Patrick Schleizer for spotting and reporting Closes: https://github.com/grml/grml-debootstrap/issues/256 --- chroot-script | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/chroot-script b/chroot-script index fafe1bf..c356bc8 100755 --- a/chroot-script +++ b/chroot-script @@ -349,6 +349,13 @@ kernel() { $APTUPDATE KVER=$(get_kernel_version) if [ -n "$KVER" ] ; then + case "$RELEASE" in + stretch) + echo "Installing busybox on Debian/$RELEASE as it's essential for the initramfs" + DEBIAN_FRONTEND=$DEBIAN_FRONTEND $APTINSTALL busybox + ;; + esac + KERNELPACKAGES="linux-image-$KVER linux-headers-$KVER firmware-linux-free $INITRD_GENERATOR" # only add firmware-linux if we have non-free as a component if expr "$COMPONENTS" : '.*non-free' >/dev/null ; then -- 2.1.4 From 9706bd99799c2d690d4c8f4f69d158aee307c408 Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Fri, 22 Dec 2023 16:20:05 -0500 Subject: [PATCH 08/16] improved error handling, removed RC=$? noops --- grml-debootstrap | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/grml-debootstrap b/grml-debootstrap index 581a74f..709230d 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -906,10 +906,12 @@ while IFS= read -r i; do done < "$TMPFILE" ERRORFILE=$(mktemp) + +local RC=0 # shellcheck disable=SC2086 yes | mdadm --create "${TARGET}" --level="${RAIDLEVEL}" \ - --raid-devices="${NUM_PARTITIONS}" ${SELECTED_PARTITIONS} >/dev/null 2>$ERRORFILE -RC=$? + --raid-devices="${NUM_PARTITIONS}" ${SELECTED_PARTITIONS} >/dev/null 2>$ERRORFILE || RC=$? + if [ "$RC" = 0 ] ; then dialog --title "$PN" --msgbox \ "Creating $TARGET was successful." 0 0 @@ -967,9 +969,7 @@ format_efi_partition() { einfo "EFI partition $EFI seems to have a FAT filesystem, not modifying." else einfo "EFI partition $EFI doesn't seem to be formatted, creating filesystem." - mkfs.fat -F32 -n "EFI" "$EFI" - RC=$? - if [ ! $RC -eq 0 ] ; then + if ! mkfs.fat -F32 -n "EFI" "$EFI" ; then eerror "Error while creating filesystem on ${EFI}." bailout 1 fi @@ -1315,7 +1315,7 @@ mkfs() { einfo "Running $MKFS $MKFS_OPTS on $TARGET" # shellcheck disable=SC2086 - "$MKFS" $MKFS_OPTS "$TARGET" ; RC=$? + "$MKFS" $MKFS_OPTS "$TARGET" if [ "$FIXED_DISK_IDENTIFIERS" = "yes" ] ; then if ! echo "$MKFS" | grep -q "mkfs.ext" ; then @@ -1728,13 +1728,11 @@ debootstrap_system() { einfo "Executing: $DEBOOTSTRAP $ARCHCMD $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $ISO" # shellcheck disable=SC2086 "$DEBOOTSTRAP" $ARCHCMD $DEBOOTSTRAP_OPT "$RELEASE" "$MNTPOINT" "$ISO" - RC=$? else einfo "Running $DEBOOTSTRAP $DEBOOTSTRAP_OPT for release ${RELEASE}${ARCHINFO} using ${MIRROR}" einfo "Executing: $DEBOOTSTRAP $ARCHCMD $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $MIRROR" # shellcheck disable=SC2086 "$DEBOOTSTRAP" $ARCHCMD $DEBOOTSTRAP_OPT "$RELEASE" "$MNTPOINT" "$MIRROR" - RC=$? fi if [ $RC -ne 0 ] ; then @@ -2065,9 +2063,9 @@ chrootscript() { mount -t devtmpfs udev "${MNTPOINT}"/dev mount -t devpts devpts "${MNTPOINT}"/dev/pts if [ "$DEBUG" = "true" ] ; then - chroot "$MNTPOINT" /bin/bash -x /bin/chroot-script ; RC=$? + chroot "$MNTPOINT" /bin/bash -x /bin/chroot-script else - chroot "$MNTPOINT" /bin/chroot-script ; RC=$? + chroot "$MNTPOINT" /bin/chroot-script fi try_umount 3 "$MNTPOINT"/dev/pts try_umount 3 "$MNTPOINT"/dev -- 2.1.4 From 48f3096e134178e8a754fe8891011c3803743d1a Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Fri, 22 Dec 2023 16:28:19 -0500 Subject: [PATCH 09/16] remove noops "eend $RC" --- grml-debootstrap | 3 --- 1 file changed, 3 deletions(-) diff --git a/grml-debootstrap b/grml-debootstrap index 709230d..126cb41 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -1352,7 +1352,6 @@ mkfs() { # race conditions :-/ sleep 2 - eend $RC fi } # }}} @@ -1744,7 +1743,6 @@ debootstrap_system() { fi fi - eend $RC } # }}} @@ -2069,7 +2067,6 @@ chrootscript() { fi try_umount 3 "$MNTPOINT"/dev/pts try_umount 3 "$MNTPOINT"/dev - eend $RC fi # finally get rid of chroot-script again, there's no good reason to -- 2.1.4 From cbd20a07125a419e7e3a62e360d07e65a084587c Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Fri, 22 Dec 2023 16:48:33 -0500 Subject: [PATCH 10/16] consistently use same code path for umounting fixes https://github.com/grml/grml-debootstrap/issues/263 --- grml-debootstrap | 51 +++++++++++++++++++-------------------------------- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/grml-debootstrap b/grml-debootstrap index 126cb41..9ad2662 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -251,9 +251,7 @@ cleanup() { einfo "Removing ${STAGES}" ; rmdir "$STAGES" || eend $? fi - if findmnt "${MNTPOINT}"/boot/efi &>/dev/null ; then - umount "${MNTPOINT}"/boot/efi - fi + try_umount 3 "${MNTPOINT}"/boot/efi # Remove temporary mountpoint again if echo "$MNTPOINT" | grep -q '/mnt/debootstrap\.' ; then @@ -282,14 +280,14 @@ cleanup() { done if [ -n "$ISODIR" ] ; then - [ -d "$MNTPOINT/$ISODIR" ] && umount "$MNTPOINT/$ISODIR" >/dev/null 2>&1 || true + try_umount 3 "$MNTPOINT/$ISODIR" >/dev/null 2>&1 || true fi if [ -n "$DIRECTORY" ] ; then einfo "Not unmounting $MNTPOINT as you requested me to install into a directory of your own choice." else einfo "Unmounting $MNTPOINT" - umount "$MNTPOINT" || eend $? + try_umount 3 "$MNTPOINT" fi if [ -n "$STAGES" ] ; then @@ -1671,19 +1669,14 @@ grub_install() { # workaround for Debian bug #918590 with lvm + udev: # WARNING: Device /dev/... not initialized in udev database even after waiting 10000000 microseconds - if mountpoint "${MNTPOINT}"/run/udev &>/dev/null ; then - einfo "Unmounting bind-mount /run/udev" - umount "${MNTPOINT}"/run/udev - fi + try_umount 3 "${MNTPOINT}"/run/udev - umount "${MNTPOINT}"/proc - umount "${MNTPOINT}"/sys - umount "${MNTPOINT}"/dev/pts + try_umount 3 "${MNTPOINT}"/proc + try_umount 3 "${MNTPOINT}"/sys + try_umount 3 "${MNTPOINT}"/dev/pts try_umount 3 "${MNTPOINT}"/dev - if findmnt "${MNTPOINT}"/boot/efi &>/dev/null ; then - umount "${MNTPOINT}"/boot/efi - fi + try_umount 3 "${MNTPOINT}"/boot/efi } # }}} @@ -1694,11 +1687,9 @@ umount_target() { return 0 fi - if findmnt "${MNTPOINT}"/boot/efi &>/dev/null ; then - umount "${MNTPOINT}"/boot/efi - fi + try_umount 3 "${MNTPOINT}"/boot/efi - umount "${MNTPOINT}" + try_umount 3 "${MNTPOINT}" kpartx -d "${ORIG_TARGET}" >/dev/null # Workaround for a bug in kpartx which doesn't clean up properly, # see Debian Bug #891077 and Github-PR grml/grml-debootstrap#112 @@ -2030,6 +2021,10 @@ try_umount() { local tries=$1 local mountpoint="$2" + if ! mountpoint "$mountpoint" &>/dev/null ; then + return 0 + fi + for (( try=1; try<=tries; try++ )); do if [[ ${try} -eq ${tries} ]]; then # Last time, show errors this time @@ -2089,22 +2084,14 @@ umount_chroot() { fi if [ -n "$ISODIR" ] ; then - if grep -q "$ISODIR" /proc/mounts ; then - einfo "Unmount $MNTPOINT/$ISODIR" - umount "$MNTPOINT/$ISODIR" - fi + einfo "Unmount $MNTPOINT/$ISODIR" + try_umount 3 "$MNTPOINT/$ISODIR" fi - if grep -q "$MNTPOINT" /proc/mounts ; then - if mountpoint "${MNTPOINT}"/run/udev &>/dev/null ; then - einfo "Unmounting bind-mount /run/udev" - umount "${MNTPOINT}"/run/udev - fi + try_umount 3 "${MNTPOINT}"/run/udev - if [ -n "$PARTITION" ] ; then - einfo "Unmount $MNTPOINT" - umount "$MNTPOINT" - fi + if [ -n "$PARTITION" ] ; then + try_umount 3 "$MNTPOINT" fi } # }}} -- 2.1.4 From 090612ac46883e1d2597412831553c83ac8cf491 Mon Sep 17 00:00:00 2001 From: Chris Hofstaedtler Date: Sat, 23 Dec 2023 16:25:43 +0100 Subject: [PATCH 11/16] ci: enable test-build on pushes to branches and periodic --- .github/workflows/test-build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index e5cc365..e22fec4 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -1,6 +1,10 @@ name: test-build on: pull_request: + push: + schedule: + - cron: '30 3 * * 2' + concurrency: group: "${{ github.ref }}" cancel-in-progress: true -- 2.1.4 From 1675ca627a824e701a55d5b50bcf9a969db7c6e1 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Sat, 23 Dec 2023 20:52:01 +0100 Subject: [PATCH 12/16] Release new version 0.106 --- debian/changelog | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/debian/changelog b/debian/changelog index c28b2e0..a72cb5d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,23 @@ +grml-debootstrap (0.106) unstable; urgency=medium + + [ Patrick Schleizer ] + - [1a229d0..cc891df] Improve error handling (PR #255) + * [81d7587] consistently use ESP label for the EFI system partition + * [9706bd9] improved error handling, removed RC=$? noops + * [48f3096] remove noops "eend $RC" + * [cbd20a0] consistently use same code path for umounting + + [ Michael Prokop ] + * [19dc059] coding style: use '[' instead of 'test' + * [325a888] Install busybox On Debian/stretch as it's required for + initramfs. Thanks to Patrick Schleizer for + spotting and reporting + + [ Chris Hofstaedtler ] + * [090612a] ci: enable test-build on pushes to branches and periodic + + -- Michael Prokop Sat, 23 Dec 2023 20:00:42 +0100 + grml-debootstrap (0.105) unstable; urgency=medium The "farewell lenny, squeeze + wheezy; hello arm64" release -- 2.1.4 From cfa16515e4c5a4d4fd6a5bf4f097379ef54b4a5d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Antoine=20Beaupr=C3=A9?= Date: Tue, 23 Jan 2024 08:50:17 -0500 Subject: [PATCH 13/16] fix debootstrap error handler We were using the old-style "RC" error checking. Now that has all been moved to a global error handler, so we need to move log parsing there as well. Fixes: 9706bd9 (improved error handling, removed RC=$? noops, 2023-12-22) Closes: #268 --- grml-debootstrap | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/grml-debootstrap b/grml-debootstrap index 9ad2662..dfef90b 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -13,6 +13,12 @@ error_handler() { last_bash_command="$BASH_COMMAND" echo "Unexpected non-zero exit code $last_exit_code in ${BASH_SOURCE[*]} at line ${BASH_LINENO[*]} detected! last bash command: $last_bash_command" + if [ -r "$MNTPOINT/debootstrap/debootstrap.log" ] && \ + [ -s "$MNTPOINT/debootstrap/debootstrap.log" ] ; then + einfo "Presenting last ten lines of debootstrap.log:" + tail -10 "${MNTPOINT}"/debootstrap/debootstrap.log + einfo "End of debootstrap.log" + fi ## Check if "bailout" function is available. ## This is not the case in chroot-script. if command -v bailout >/dev/null 2>&1; then @@ -1724,16 +1730,6 @@ debootstrap_system() { # shellcheck disable=SC2086 "$DEBOOTSTRAP" $ARCHCMD $DEBOOTSTRAP_OPT "$RELEASE" "$MNTPOINT" "$MIRROR" fi - - if [ $RC -ne 0 ] ; then - if [ -r "$MNTPOINT/debootstrap/debootstrap.log" ] && \ - [ -s "$MNTPOINT/debootstrap/debootstrap.log" ] ; then - einfo "Presenting last ten lines of debootstrap.log:" - tail -10 "${MNTPOINT}"/debootstrap/debootstrap.log - einfo "End of debootstrap.log" - fi - fi - } # }}} -- 2.1.4 From df9c1ae2086610336fe7334a107dfe806765935a Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 2 Feb 2024 12:31:57 +0100 Subject: [PATCH 14/16] Release new version 0.107 --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index a72cb5d..fe6787e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +grml-debootstrap (0.107) unstable; urgency=medium + + [ Antoine Beaupré ] + * [cfa1651] fix debootstrap error handler + + -- Michael Prokop Fri, 02 Feb 2024 12:31:41 +0100 + grml-debootstrap (0.106) unstable; urgency=medium [ Patrick Schleizer ] -- 2.1.4 From 811c294079691675c4815808fe780e472bf84233 Mon Sep 17 00:00:00 2001 From: Darshaka Pathirana Date: Fri, 2 Feb 2024 15:11:20 +0100 Subject: [PATCH 15/16] Move try_umount above cleanup() try_umount() replaced all umount calls in PR #264. Unfortunately, the function is defined too late for a few of functions, especially for cleanup(), which fails with: -> Failed (rc=1) /sbin/grml-debootstrap: line 260: try_umount: command not found Unexpected non-zero exit code 127 in /sbin/grml-debootstrap /sbin/grml-debootstrap /sbin/grml-debootstrap /sbin/grml-debootstrap /sbin/grml-debootstrap at line 260 329 1107 1179 0 detected! last bash command: try_umount 3 "${MNTPOINT}"/boot/efi -> Failed (rc=1) /sbin/grml-debootstrap: line 260: try_umount: command not found Moved the try_umount above cleanup(). Closes: #271 --- grml-debootstrap | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/grml-debootstrap b/grml-debootstrap index dfef90b..97dc26b 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -247,6 +247,32 @@ check4progs(){ } # }}} +# unmount mountpoint {{{ +try_umount() { + local tries=$1 + local mountpoint="$2" + + if ! mountpoint "$mountpoint" &>/dev/null ; then + return 0 + fi + + for (( try=1; try<=tries; try++ )); do + if [[ ${try} -eq ${tries} ]]; then + # Last time, show errors this time + umount "${mountpoint}" && return 0 + else + # Not last time, hide errors until fatal + if umount "${mountpoint}" 2>/dev/null ; then + return 0 + else + sleep 1 + fi + fi + done + return 1 # Tried enough +} +# }}} + # helper functions {{{ cleanup() { if [ -n "$CHROOT_VARIABLES" ] ; then @@ -2012,32 +2038,6 @@ execute_post_scripts() { } # }}} -# unmount mountpoint {{{ -try_umount() { - local tries=$1 - local mountpoint="$2" - - if ! mountpoint "$mountpoint" &>/dev/null ; then - return 0 - fi - - for (( try=1; try<=tries; try++ )); do - if [[ ${try} -eq ${tries} ]]; then - # Last time, show errors this time - umount "${mountpoint}" && return 0 - else - # Not last time, hide errors until fatal - if umount "${mountpoint}" 2>/dev/null ; then - return 0 - else - sleep 1 - fi - fi - done - return 1 # Tried enough -} -# }}} - # execute chroot-script {{{ chrootscript() { if ! [ -r "$MNTPOINT/bin/chroot-script" ] ; then -- 2.1.4 From fa44c61d9c8b7a1559d409a0d6f8fbdcb7350cac Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Sat, 24 Feb 2024 10:55:45 +0100 Subject: [PATCH 16/16] Release new version 0.108 --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index fe6787e..98227ec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +grml-debootstrap (0.108) unstable; urgency=medium + + [ Darshaka Pathirana ] + * [811c294] Move try_umount above cleanup() + + -- Michael Prokop Sat, 24 Feb 2024 10:55:23 +0100 + grml-debootstrap (0.107) unstable; urgency=medium [ Antoine Beaupré ] -- 2.1.4