From 3adfc0385e163f49b85f25ec534b218d00b6bed0 Mon Sep 17 00:00:00 2001 From: Jason Mehring Date: Mon, 27 Apr 2015 21:18:07 -0400 Subject: [PATCH 1/2] 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 --- functions.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/functions.sh b/functions.sh index acc819f..e4c2d27 100755 --- a/functions.sh +++ b/functions.sh @@ -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 From fe6b1be0dbc1621256b33110e7511e29c6cd789d Mon Sep 17 00:00:00 2001 From: Jason Mehring Date: Mon, 27 Apr 2015 21:20:29 -0400 Subject: [PATCH 2/2] Allow appmenus to be located using APPMENUS_DIR ENV variable Allows Whonix appmenus to located in its own package --- qubeize_image | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/qubeize_image b/qubeize_image index 2612799..01006d6 100755 --- a/qubeize_image +++ b/qubeize_image @@ -77,13 +77,14 @@ export INSTALLDIR=mnt # Create App Menus # ------------------------------------------------------------------------------ echo "--> Choosing appmenus whitelists..." +_appmenus_dir="${APPMENUS_DIR-${SCRIPTSDIR}}" rm -f appmenus -if [ -d "${SCRIPTSDIR}/appmenus_${DIST}_${TEMPLATE_FLAVOR}" ]; then - ln -s "${SCRIPTSDIR}/appmenus_${DIST}_${TEMPLATE_FLAVOR}" appmenus -elif [ -d "${SCRIPTSDIR}/appmenus_$DIST" ]; then - ln -s "${SCRIPTSDIR}/appmenus_$DIST" appmenus -elif [ -d "${SCRIPTSDIR}/appmenus" ]; then - ln -s "${SCRIPTSDIR}/appmenus" appmenus +if [ -d "${_appmenus_dir}/appmenus_${DIST}_${TEMPLATE_FLAVOR}" ]; then + ln -s "${_appmenus_dir}/appmenus_${DIST}_${TEMPLATE_FLAVOR}" appmenus +elif [ -d "${_appmenus_dir}/appmenus_$DIST" ]; then + ln -s "${_appmenus_dir}/appmenus_$DIST" appmenus +elif [ -d "${_appmenus_dir}/appmenus" ]; then + ln -s "${_appmenus_dir}/appmenus" appmenus else ln -s "appmenus_generic" appmenus fi