summaryrefslogtreecommitdiff
path: root/helpers/lh_binary_encryption
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2007-09-23 10:04:49 +0200
committerDaniel Baumann <daniel@debian.org>2011-03-09 18:18:29 +0100
commit1863ed88740575342008ac5f694d03e944bcece2 (patch)
tree58272f72528cedb7af31ee6e6c2c0f7fbd602160 /helpers/lh_binary_encryption
parentda353a5231ad925013d01065768864307c70651a (diff)
downloadvyos-live-build-1863ed88740575342008ac5f694d03e944bcece2.tar.gz
vyos-live-build-1863ed88740575342008ac5f694d03e944bcece2.zip
Adding live-helper 1.0~a5-1.
Diffstat (limited to 'helpers/lh_binary_encryption')
-rwxr-xr-xhelpers/lh_binary_encryption128
1 files changed, 68 insertions, 60 deletions
diff --git a/helpers/lh_binary_encryption b/helpers/lh_binary_encryption
index 03c056f05..09c0fea72 100755
--- a/helpers/lh_binary_encryption
+++ b/helpers/lh_binary_encryption
@@ -22,64 +22,73 @@ USAGE="${PROGRAM} [--force]"
Arguments "${@}"
+Echo_debug "Init ${PROGRAM}"
+
# Reading configuration files
+Read_conffile config/bootstrap
+Read_conffile config/chroot
Read_conffile config/common
Read_conffile config/image
Set_defaults
-if [ -n "${LIVE_ENCRYPTION}" ]
+if [ -z "${LIVE_ENCRYPTION}" ]
then
- # Requiring stage file
- Require_stagefile .stage/bootstrap
- Require_stagefile .stage/binary_rootfs
+ exit 0
+fi
- # Checking lock file
- Check_lockfile .lock
+Breakpoint "binary_encryption: Init"
- # Creating lock file
- Create_lockfile .lock
+# Requiring stage file
+Require_stagefile .stage/bootstrap
+Require_stagefile .stage/binary_rootfs
- # Checking stage file
- Check_stagefile .stage/binary_encryption
+# Checking lock file
+Check_lockfile .lock
- case "${LIVE_FILESYSTEM}" in
- ext2)
- ROOTFS="ext2"
- ;;
+# Creating lock file
+Create_lockfile .lock
- plain)
- echo "W: encryption not supported on plain filesystem."
- exit 0
- ;;
+# Checking stage file
+Check_stagefile .stage/binary_encryption
- squashfs)
- ROOTFS="squashfs"
- ;;
- esac
+case "${LIVE_FILESYSTEM}" in
+ ext2)
+ ROOTFS="ext2"
+ ;;
- if [ ! -f chroot/usr/bin/aespipe ]
- then
- PACKAGES="${PACKAGES} aespipe"
- fi
+ plain)
+ echo "W: encryption not supported on plain filesystem."
+ exit 0
+ ;;
- if [ -n "${PACKAGES}" ]
- then
- # Installing packages
- case "${LH_APT}" in
- apt|apt-get)
- Chroot "apt-get install --yes ${PACKAGES}"
- ;;
+ squashfs)
+ ROOTFS="squashfs"
+ ;;
+esac
- aptitude)
- Chroot "aptitude install --assume-yes ${PACKAGES}"
- ;;
- esac
- fi
+if [ ! -f chroot/usr/bin/aespipe ]
+then
+ PACKAGES="${PACKAGES} aespipe"
+fi
- # Moving image
- mv binary/casper/filesystem.${LIVE_FILESYSTEM} chroot
+if [ -n "${PACKAGES}" ]
+then
+ # Installing packages
+ case "${LH_APT}" in
+ apt|apt-get)
+ Chroot "apt-get install --yes ${PACKAGES}"
+ ;;
- echo "Encrypting binary/casper/filesystem.${ROOTFS} with ${LIVE_ENCRYPTION}..."
+ aptitude)
+ Chroot "aptitude install --assume-yes ${PACKAGES}"
+ ;;
+ esac
+fi
+
+# Moving image
+mv binary/casper/filesystem.${LIVE_FILESYSTEM} chroot
+
+echo "Encrypting binary/casper/filesystem.${ROOTFS} with ${LIVE_ENCRYPTION}..."
cat >> chroot/encrypt << EOF
while true
@@ -98,25 +107,24 @@ do
done
EOF
- Chroot "sh encrypt"
-
- # Move image
- mv chroot/filesystem.${LIVE_FILESYSTEM} binary/casper
- rm -f chroot/encrypt
+Chroot "sh encrypt"
- # Removing packages
- if [ -n "${PACKAGES}" ]
- then
- case "${LH_APT}" in
- apt|apt-get)
- Chroot "apt-get remove --purge --yes ${PACKAGES}"
- ;;
- aptitude)
- Chroot "aptitude purge --assume-yes ${PACKAGES}"
- ;;
- esac
- fi
+# Move image
+mv chroot/filesystem.${LIVE_FILESYSTEM} binary/casper
+rm -f chroot/encrypt
- # Creating stage file
- Create_stagefile .stage/binary_encryption
+# Removing packages
+if [ -n "${PACKAGES}" ]
+then
+ case "${LH_APT}" in
+ apt|apt-get)
+ Chroot "apt-get remove --purge --yes ${PACKAGES}"
+ ;;
+ aptitude)
+ Chroot "aptitude purge --assume-yes ${PACKAGES}"
+ ;;
+ esac
fi
+
+# Creating stage file
+Create_stagefile .stage/binary_encryption