summaryrefslogtreecommitdiff
path: root/helpers/lh_genrootfs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2007-09-23 10:04:40 +0200
committerDaniel Baumann <daniel@debian.org>2007-09-23 10:04:40 +0200
commit6f5e2da03e5fd1af2200d2f55ca84647bc8d3626 (patch)
treee2a861c1995eea707b2ac1c72930351191714493 /helpers/lh_genrootfs
parent9a9491318d4a0469e4c97b28879ab34391c39095 (diff)
downloadlive-build-6f5e2da03e5fd1af2200d2f55ca84647bc8d3626.zip
live-build-6f5e2da03e5fd1af2200d2f55ca84647bc8d3626.tar.gz
Adding live-package 0.99.22-1.
Diffstat (limited to 'helpers/lh_genrootfs')
-rwxr-xr-xhelpers/lh_genrootfs71
1 files changed, 71 insertions, 0 deletions
diff --git a/helpers/lh_genrootfs b/helpers/lh_genrootfs
new file mode 100755
index 0000000..9ba4b31
--- /dev/null
+++ b/helpers/lh_genrootfs
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+# lh_genrootfs.sh <filesystem>
+
+case "${LIVE_FILESYSTEM}" in
+ ext2)
+ DU_DIM="`du -ks ${LIVE_CHROOT} | cut -f1`"
+ REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 20`" # Just 5% more to be sure, need something more sophistcated here...
+
+ if [ -z "${LIVE_ENCRYPTION}" ]
+ then
+ genext2fs --size-in-blocks=${REAL_DIM} --reserved-blocks=0 --root="${LIVE_CHROOT}" "${LIVE_ROOT}"/binary/casper/filesystem.ext2
+ else
+ echo "Encrypting ${LIVE_ROOT}/binary/casper/filesystem.ext2 with ${LIVE_ENCRYPTION}..."
+
+ while true
+ do
+ genext2fs --size-in-blocks=${REAL_DIM} --reserved-blocks=0 --root="${LIVE_CHROOT}" | aespipe -e "${LIVE_ENCRYPTION}" -T > "${LIVE_ROOT}"/binary/casper/filesystem.ext2 && break
+
+ echo -n "Something went wrong... Retry? [YES/no] "
+ read ANSWER
+
+ if [ 'no' = "${ANSWER}" ]
+ then
+ unset ANSWER
+ break
+ fi
+ done
+ fi
+ ;;
+
+ plain)
+ if [ -n "${LIVE_ENCRYPTION}" ]
+ then
+ echo "Error: encryption is not supported for filesystem type 'plain'"
+ exit 1
+ fi
+
+ cd "${LIVE_CHROOT}"
+ find . | cpio -pumd "${LIVE_ROOT}"/binary/casper/filesystem.dir
+ cd "${OLDPWD}"
+ ;;
+
+ squashfs)
+ if [ -f "${LIVE_ROOT}"/binary/casper/filesystem.squashfs ]
+ then
+ rm "${LIVE_ROOT}"/binary/casper/filesystem.squashfs
+ fi
+
+ mksquashfs "${LIVE_CHROOT}" "${LIVE_ROOT}"/binary/casper/filesystem.squashfs
+
+ if [ -n "$LIVE_ENCRYPTION" ]
+ then
+ echo "Encrypting ${LIVE_ROOT}/binary/casper/filesystem.squashfs with ${LIVE_ENCRYPTION}..."
+
+ while true
+ do
+ cat "${LIVE_ROOT}"/binary/casper/filesystem.squashfs | aespipe -e "${LIVE_ENCRYPTION}" -T > "${LIVE_ROOT}"/binary/casper/filesystem.squashfs.encrypted && mv "${LIVE_ROOT}"/binary/casper/filesystem.squashfs.encrypted "${LIVE_ROOT}"/binary/casper/filesystem.squashfs && break
+
+ echo -n "Something went wrong... Retry? [YES/no] "
+ read ANSWER
+
+ if [ 'no' = "${ANSWER}" ]
+ then
+ unset ANSWER
+ break
+ fi
+ done
+ fi
+ ;;
+esac