SYSTEMD_NSPAWN_ENABLE was missing from chroot if VERBOSE was < 2
- Added some more chroot wrapper function comments - changed "${@}" to ${1+"$@"} for better form in chroot function
This commit is contained in:
parent
8ed287f166
commit
3adfc0385e
15
functions.sh
15
functions.sh
@ -81,19 +81,28 @@ fi
|
|||||||
|
|
||||||
if [ "${VERBOSE}" -ge 2 -o "${DEBUG}" == "1" ]; then
|
if [ "${VERBOSE}" -ge 2 -o "${DEBUG}" == "1" ]; then
|
||||||
chroot() {
|
chroot() {
|
||||||
|
# Display `chroot` or `systemd-nspawn` in blue ONLY if VERBOSE >= 2
|
||||||
|
# or DEBUG == "1"
|
||||||
local retval
|
local retval
|
||||||
true ${blue}
|
true ${blue}
|
||||||
|
|
||||||
|
# Need to capture exit code after running chroot or systemd-nspawn
|
||||||
|
# so it will be available as a return value
|
||||||
if [ "${SYSTEMD_NSPAWN_ENABLE}" == "1" ]; then
|
if [ "${SYSTEMD_NSPAWN_ENABLE}" == "1" ]; then
|
||||||
systemd-nspawn $systemd_bind -D "${INSTALLDIR}" -M "${DIST}" "$@" && { retval=$?; true; } || { retval=$?; true; }
|
systemd-nspawn $systemd_bind -D "${INSTALLDIR}" -M "${DIST}" ${1+"$@"} && { retval=$?; true; } || { retval=$?; true; }
|
||||||
else
|
else
|
||||||
/usr/sbin/chroot "${INSTALLDIR}" "$@" && { retval=$?; true; } || { retval=$?; true; }
|
/usr/sbin/chroot "${INSTALLDIR}" ${1+"$@"} && { retval=$?; true; } || { retval=$?; true; }
|
||||||
fi
|
fi
|
||||||
true ${reset}
|
true ${reset}
|
||||||
return $retval
|
return $retval
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
chroot() {
|
chroot() {
|
||||||
/usr/sbin/chroot "${INSTALLDIR}" "$@"
|
if [ "${SYSTEMD_NSPAWN_ENABLE}" == "1" ]; then
|
||||||
|
systemd-nspawn $systemd_bind -D "${INSTALLDIR}" -M "${DIST}" ${1+"$@"}
|
||||||
|
else
|
||||||
|
/usr/sbin/chroot "${INSTALLDIR}" ${1+"$@"}
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user