|
|
|
@ -72,13 +72,16 @@ do
|
|
|
|
|
CDROOT=1
|
|
|
|
|
CDROOT_DEV=`parse_opt "${x}"`
|
|
|
|
|
;;
|
|
|
|
|
# Start livecd loop and looptype options
|
|
|
|
|
# Start livecd loop, looptype options and encryption
|
|
|
|
|
loop\=*)
|
|
|
|
|
LOOP=`parse_opt "${x}"`
|
|
|
|
|
;;
|
|
|
|
|
looptype\=*)
|
|
|
|
|
LOOPTYPE=`parse_opt "${x}"`
|
|
|
|
|
;;
|
|
|
|
|
loop_crypt\=*)
|
|
|
|
|
LOOP_CRYPT=`parse_opt "${x}"`
|
|
|
|
|
;;
|
|
|
|
|
# Start Device Manager options
|
|
|
|
|
devfs)
|
|
|
|
|
USE_DEVFS_NORMAL=1
|
|
|
|
@ -261,7 +264,7 @@ then
|
|
|
|
|
mount -t tmpfs tmpfs ${NEW_ROOT}
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
for i in dev mnt mnt/cdrom mnt/livecd tmp tmp/.initrd mnt/gentoo sys
|
|
|
|
|
for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
|
|
|
|
|
do
|
|
|
|
|
mkdir -p ${NEW_ROOT}/$i
|
|
|
|
|
chmod 755 ${NEW_ROOT}/$i
|
|
|
|
@ -490,8 +493,46 @@ then
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
cache_cd_contents
|
|
|
|
|
# Setup the loopback mounts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If encrypted, find key and mount, otherwise mount as usual
|
|
|
|
|
if [ "${LOOP_CRYPT}" != '' ]
|
|
|
|
|
then
|
|
|
|
|
good_msg 'You booted an encrypted livecd'
|
|
|
|
|
KEYNAME=$(head -n 1 ${NEW_ROOT}/mnt/cdrom/livecd)
|
|
|
|
|
|
|
|
|
|
if [ "${KEYNAME}" = '' ]
|
|
|
|
|
then
|
|
|
|
|
good_msg 'It's not locked with a gpg key, attempting to decrypt manually'
|
|
|
|
|
losetup -e ${LOOP_CRYPT} /dev/loop1 ${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
good_msg 'Livecd locked with gpg key'
|
|
|
|
|
bootstrapKey
|
|
|
|
|
good_msg 'Attempting to decrypt with key'
|
|
|
|
|
losetup -K ${NEW_ROOT}/mnt/key/${SUBDIR}/${KEYNAME} -e ${LOOP_CRYPT} /dev/loop1 \
|
|
|
|
|
${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
test_success 'Unencrypting loop'
|
|
|
|
|
|
|
|
|
|
case ${LOOPTYPE} in
|
|
|
|
|
squashfs)
|
|
|
|
|
MOUNTTYPE="squashfs"
|
|
|
|
|
normal)
|
|
|
|
|
MOUNTTYPE="ext2"
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
mount -t ${MOUNTTYPE} -o ro /dev/loop1 ${NEW_ROOT}/mnt/livecd
|
|
|
|
|
|
|
|
|
|
test_success 'Mount filesystem, checking key'
|
|
|
|
|
FS_LOCATION='mnt/livecd'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Setup the loopback mounts, if unencrypted
|
|
|
|
|
else
|
|
|
|
|
if [ "${LOOPTYPE}" = 'normal' ]
|
|
|
|
|
then
|
|
|
|
|
good_msg 'Mounting loop filesystem'
|
|
|
|
|