From 0f79aaeb966a9a6daefc113e0961a65d752c76c0 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 23 Sep 2026 06:08:04 -0400 Subject: sbrun: clean up after overlay umount, correctly handle exit status with -l -i. --- sbrun | 57 ++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/sbrun b/sbrun index fe5f809..f55226c 100755 --- a/sbrun +++ b/sbrun @@ -29,7 +29,11 @@ if [ "$(id -u)" != "0" ]; then "$0" "$@" fi +# This is a bit of a hack: I keep my tools in my user's ~/bin, +# and sourcing /etc/profile blows away PATH... +OLDPATH=$PATH source /etc/profile +PATH=$OLDPATH:$PATH [ -e "$BUILDLOG" ] && mv "$BUILDLOG" "$BUILDLOG".old @@ -284,6 +288,30 @@ cleanup_log() { [ -n "$LOGDIR" ] && rm -rf "$LOGDIR" } +cleanup_privdir() { + [ "$PRIVDIR" = "" ] && return + umount $FAKEROOT/$OUTPUT + umount $FAKEROOT/$TMP + umount $FAKEROOT + if [ "$?" != "0" ]; then + cat < /dev/null @@ -528,20 +558,6 @@ echo "$SCRIPT exit status: $RET" | tee -a $BUILDLOG } | tee -a $BUILDLOG cleanup_nonet -umount $FAKEROOT/$OUTPUT -umount $FAKEROOT/$TMP -umount $FAKEROOT -if [ "$?" != "0" ]; then - cat < $TMP/sbrun.turds.$$ -) +) 2>/dev/null + +cleanup_privdir + if [ -s $TMP/sbrun.turds.$$ ]; then warn "WARNING: files altered outside the sandbox:" cat $TMP/sbrun.turds.$$ 1>&2 @@ -584,7 +603,11 @@ rm -f $TMP/sbrun.turds.$$ # If linting + installation were both requested, don't install # the package if it fails to lint. -[ "$LINTPKG" = "yes" ] && sbopkglint || UPKG="" +if [ "$LINTPKG" = "yes" ] && sbopkglint; then + RET=$? +else + UPKG="" +fi # spawn shell(s) if requested. -i and -p are not mutually exclusive. @@ -616,7 +639,7 @@ fi cleanup_build -# Install the package if -u. +# Install the package if -i. [ "$RET" = "0" ] && [ "$UPKG" = "yes" ] && upkg # Our return status is that of the SlackBuild. -- cgit v1.2.3