about summary refs log tree commit diff
path: root/xchroot
diff options
context:
space:
mode:
authorStefan Kreutz <mail@skreutz.com>2023-02-08 22:36:53 +0100
committerLeah Neukirchen <leah@vuxu.org>2023-02-08 23:00:58 +0100
commit714a2f30c1479865bc1b157c4b2165ce091b0ed8 (patch)
treeeef516d4081d32b700ba2260d3194d42b21339a6 /xchroot
parentbd44e7cec69e7a2eef88c787211e4baa906954e8 (diff)
downloadxtools-714a2f30c1479865bc1b157c4b2165ce091b0ed8.tar.gz
xtools-714a2f30c1479865bc1b157c4b2165ce091b0ed8.tar.xz
xtools-714a2f30c1479865bc1b157c4b2165ce091b0ed8.zip
xchroot: propagate chroot(1)'s exit code
Changes xchroot to exit with chroot(1)'s exit code on error.
Diffstat (limited to 'xchroot')
-rwxr-xr-xxchroot7
1 files changed, 5 insertions, 2 deletions
diff --git a/xchroot b/xchroot
index bca68d8..b86819a 100755
--- a/xchroot
+++ b/xchroot
@@ -41,8 +41,11 @@ fi
 
 printf "\033[1m=> Entering chroot $CHROOT\033[m\n"
 export PS1="[xchroot $CHROOT] $PS1"
-if chroot "$CHROOT" ${@:-$INNER_SHELL}; then
+chroot "$CHROOT" ${@:-$INNER_SHELL}
+STATUS=$?
+if [ $STATUS -ne 0 ]; then
 	printf "\033[1m=> Exited chroot $CHROOT\033[m\n"
 else
-	printf "\033[1m=> Exited chroot $CHROOT with status $?\033[m\n"
+	printf "\033[1m=> Exited chroot $CHROOT with status $STATUS\033[m\n"
 fi
+exit $STATUS