diff --git a/debian/changelog b/debian/changelog index c2e5d729..79226ac4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,7 @@ livecd-rootfs (1.116) UNRELEASED; urgency=low * added new -f switch for changing image build type - * added support for building ext2/ext3/ext4 images in addition to squashfs + * added support for building ext2 and ext3 images in addition to squashfs * fixed spacing in the livefs build code * extended BuildLiveCD to handle the -f switch * reworked BuildLiveCD command line parsing to be more sane diff --git a/livecd.sh b/livecd.sh index 8fd31cee..6da94099 100755 --- a/livecd.sh +++ b/livecd.sh @@ -21,13 +21,12 @@ set -eu # Boston, MA 02110-1301 USA. # ########################################################################## -# Depends: debootstrap, rsync, python-minimal|python, procps, squashfs-tools, ltsp-server [i386] +# Depends: debootstrap, rsync, python-minimal|python, procps, squashfs-tools, ltsp-server [i386], genext2fs cleanup() { for mnt in ${ROOT}dev/pts ${ROOT}dev/shm ${ROOT}.dev ${ROOT}dev \ ${ROOT}proc/sys/fs/binfmt_misc ${ROOT}proc ${ROOT}sys \ - ${ROOT}lib/modules/*/volatile ${ROOT}var/{lock,run} \ - `pwd`/mount-livefs; do + ${ROOT}lib/modules/*/volatile ${ROOT}var/{lock,run}; do umount $mnt || true done @@ -75,33 +74,16 @@ livefs_squash() chmod 644 livecd.${FSS}.squashfs } -# This function could be extended for other non-ext filesystems, but -# they aren't consistant on how you format a non-block device - -livefs_ext() +livefs_ext2() { # Add 10MiB extra free space for first boot + ext3 journal - size=$((($(du -sx --block-size=1024 ${ROOT} | cut -f1) + (10240)) * 1024)) - mountpoint=`pwd`/mount-livefs/ - echo "Building $IMAGEFORMAT filesystem." + size=$(($(du -ks ${ROOT} | cut -f1) + (10240))) + echo "Building ext2 filesystem." # remove any stale filesystem images - rm -f livecd.${FSS}.$IMAGEFORMAT - - # Make blank filesystem, and loopmount it - dd if=/dev/zero of=livecd.$FSS.$IMAGEFORMAT bs=$size count=1 - mkfs -t $IMAGEFORMAT -F livecd.$FSS.$IMAGEFORMAT - rm -fr $mountpoint - mkdir $mountpoint - mount -o loop ./livecd.$FSS.$IMAGEFORMAT $mountpoint - rm -fr $mountpoint/lost+found - - # Copy everything from the rootfs into the ext2 image - cp -ar $ROOT/* $mountpoint - - # Call cleanup again to unmount everything and make sure loop0 is cleared - cleanup - rm -rf mount-livefs + rm -f livecd.${FSS}.squashfs + + genext2fs -b $size -d ${ROOT} livecd.${FSS}.ext2 } if [ $(id -u) != 0 ];then @@ -686,13 +668,18 @@ Pin-Priority: 550 # Build our images - if [ "$IMAGEFORMAT" = "ext2" ] || [ "$IMAGEFORMAT" = "ext3" ] \ - || [ "$IMAGEFORMAT" = "ext4" ]; then - livefs_ext + if [ "$IMAGEFORMAT" = "ext2" ] || [ "$IMAGEFORMAT" = "ext3" ]; then + livefs_ext2 else livefs_squash fi + # Upgrade ext2->ext3 if that's what is requested + if [ "$IMAGEFORMAT" = "ext3" ]; then + tune2fs -j livecd.${FSS}.ext2 + mv livecd.${FSS}.ext2 livecd.${FSS}.ext3 + fi + # LTSP chroot building (only in 32bit and for Edubuntu (DVD)) case $FS in edubuntu-dvd)