2007-09-23 08:04:46 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# lh_binary_encryption(1) - encrypts rootfs
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Source common functions
|
|
|
|
for FUNCTION in /usr/share/live-helper/functions/*.sh
|
|
|
|
do
|
|
|
|
. ${FUNCTION}
|
|
|
|
done
|
|
|
|
|
|
|
|
# Reading configuration files
|
|
|
|
Read_conffile config/common
|
|
|
|
Read_conffile config/image
|
|
|
|
Set_defaults
|
|
|
|
|
|
|
|
# Requiring stage file
|
2007-09-23 08:04:47 +00:00
|
|
|
Require_stagefile .stage/bootstrap
|
|
|
|
Require_stagefile .stage/binary_rootfs
|
2007-09-23 08:04:46 +00:00
|
|
|
|
|
|
|
# Checking lock file
|
2007-09-23 08:04:47 +00:00
|
|
|
Check_lockfile .lock
|
2007-09-23 08:04:46 +00:00
|
|
|
|
|
|
|
# Creating lock file
|
2007-09-23 08:04:47 +00:00
|
|
|
Create_lockfile .lock
|
2007-09-23 08:04:46 +00:00
|
|
|
|
|
|
|
# Checking stage file
|
2007-09-23 08:04:47 +00:00
|
|
|
Check_stagefile .stage/binary_encryption
|
2007-09-23 08:04:46 +00:00
|
|
|
|
|
|
|
if [ -n "${LIVE_ENCRYPTION}" ]
|
|
|
|
then
|
|
|
|
if [ ! -x /usr/bin/aespipe ]
|
|
|
|
then
|
|
|
|
echo "E: aespipe is missing (FIXME)."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "${LIVE_FILESYSTEM}" in
|
|
|
|
ext2)
|
|
|
|
ROOTFS="ext2"
|
|
|
|
;;
|
|
|
|
|
|
|
|
plain)
|
|
|
|
echo "W: encryption not supported on plain filesystem."
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
squashfs)
|
|
|
|
ROOTFS="squashfs"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2007-09-23 08:04:47 +00:00
|
|
|
echo "Encrypting binary/casper/filesystem.${ROOTFS} with ${LIVE_ENCRYPTION}..."
|
2007-09-23 08:04:46 +00:00
|
|
|
|
|
|
|
while true
|
|
|
|
do
|
2007-09-23 08:04:47 +00:00
|
|
|
cat binary/casper/filesystem.${ROOTFS} | aespipe -e "${LIVE_ENCRYPTION}" -T > binary/casper/filesystem.${ROOTFS} && break
|
2007-09-23 08:04:46 +00:00
|
|
|
|
|
|
|
echo -n "Something went wrong... Retry? [YES/no] "
|
|
|
|
|
|
|
|
read ANSWER
|
|
|
|
|
|
|
|
if [ 'no' = "${ANSWER}" ]
|
|
|
|
then
|
|
|
|
unset ANSWER
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Creating stage file
|
2007-09-23 08:04:47 +00:00
|
|
|
Create_stagefile .stage/binary_encryption
|
2007-09-23 08:04:46 +00:00
|
|
|
fi
|