Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/272'
Browse files Browse the repository at this point in the history
  • Loading branch information
mika committed Feb 2, 2024
2 parents df9c1ae + 811c294 commit 7dc77a0
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions grml-debootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7dc77a0

Please sign in to comment.