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:
Jason Mehring 2015-04-27 21:18:07 -04:00
parent 8ed287f166
commit 3adfc0385e
No known key found for this signature in database
GPG Key ID: 1BB9B1FB5A4C6DAD

View File

@ -81,19 +81,28 @@ fi
if [ "${VERBOSE}" -ge 2 -o "${DEBUG}" == "1" ]; then
chroot() {
# Display `chroot` or `systemd-nspawn` in blue ONLY if VERBOSE >= 2
# or DEBUG == "1"
local retval
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
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
/usr/sbin/chroot "${INSTALLDIR}" "$@" && { retval=$?; true; } || { retval=$?; true; }
/usr/sbin/chroot "${INSTALLDIR}" ${1+"$@"} && { retval=$?; true; } || { retval=$?; true; }
fi
true ${reset}
return $retval
}
else
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