diff options
author | Stefan Kreutz <mail@skreutz.com> | 2023-02-08 22:36:53 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2023-02-08 23:00:58 +0100 |
commit | 714a2f30c1479865bc1b157c4b2165ce091b0ed8 (patch) | |
tree | eef516d4081d32b700ba2260d3194d42b21339a6 /xchroot | |
parent | bd44e7cec69e7a2eef88c787211e4baa906954e8 (diff) | |
download | xtools-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-x | xchroot | 7 |
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 |