bdisk/lib/04-chroot_wrapper.func.sh

30 lines
689 B
Bash
Raw Permalink Normal View History

2014-12-19 14:13:30 -05:00
function chroot_wrapper () {
local ARCHSUFFIX="${1}"
if [[ "${1}" == "64" ]];
then
local CHROOTDIR="${CHROOTDIR}root.x86_64"
local BUILDDIR="${BUILDDIR}64"
elif [[ "${1}" == "32" ]];
then
local CHROOTDIR="${CHROOTDIR}root.i686"
local BUILDDIR="${BUILDDIR}32"
else
echo "WHOOPS. We hit an error that makes no logical sense."
echo 'Dying.'
exit 1
fi
if [ -f "/usr/bin/systemd-nspawn" ];
then
CHROOTCMD="systemd-nspawn -D ${CHROOTDIR}"
else
CHROOTCMD="facehugger ${ARCHSUFFIX}"
fi
echo "NOW ENTERING ${CHROOTDIR}...."
echo "_____________________________"
${CHROOTCMD}
CHROOTDIR="${CHROOTDIR_GLOB}"
BUILDDIR="${BUILDDIR_GLOB}"
}