From c87828dd362ea397909e9a358d7f16c0be413654 Mon Sep 17 00:00:00 2001 From: Michael Casadevall Date: Mon, 17 May 2010 12:59:17 -0400 Subject: [PATCH 01/10] * added new -f switch for changing image build type * added support for building ext2 and ext3 images in addition to squashfs --- debian/changelog | 7 +++++++ livecd.sh | 23 ++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 758c6842..06bdd57e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +livecd-rootfs (1.116) UNRELEASED; urgency=low + + * added new -f switch for changing image build type + * added support for building ext2 and ext3 images in addition to squashfs + + -- Michael Casadevall Mon, 17 May 2010 12:47:16 -0400 + livecd-rootfs (1.115) maverick; urgency=low * use a tmpfs for the livefs root directory, to get some speed diff --git a/livecd.sh b/livecd.sh index 904781f4..85fdb58e 100755 --- a/livecd.sh +++ b/livecd.sh @@ -21,7 +21,7 @@ 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], e2tools cleanup() { for mnt in ${ROOT}dev/pts ${ROOT}dev/shm ${ROOT}.dev ${ROOT}dev \ @@ -118,11 +118,12 @@ EXCLUDE="" LIST="" SUBARCH="" PROPOSED="" +IMAGE_FORMAT="squashfs" # must be in the "team / PPA name" form; e.g. "moblin/ppa"; the default PPA # name is "ppa", don't omit it PPA="" -while getopts :d:e:i:I:m:S:s:a:p name; do case $name in +while getopts :d:e:i:I:m:S:s:a:f:p name; do case $name in d) STE=$OPTARG;; e) EXCLUDE="$EXCLUDE $OPTARG";; i) LIST="$LIST $OPTARG";; @@ -131,6 +132,7 @@ while getopts :d:e:i:I:m:S:s:a:p name; do case $name in S) USZ="$OPTARG";; s) SUBARCH="$OPTARG";; a) ARCH="$OPTARG";; + f) IMAGE_FORMAT="$OPTARG";; p) PROPOSED="yes";; \?) echo bad usage >&2; exit 2;; \:) echo missing argument >&2; exit 2;; @@ -652,7 +654,22 @@ Pin-Priority: 550 chmod 644 livecd.${FSS}.squashfs } - livefs_squash + livefs_ext2() + { + size=$(du -sx --block-size=1024 ${ROOT} | cut -f1) + echo "Building ext2 filesystem." + + # remove any stale filesystem images + rm -f livecd.${FSS}.squashfs + + genext2fs -b $size -d ${ROOT} livecd.${FSS}.ext2 + } + + if [ "$IMAGE_FORMAT" = "ext2" ] || [ "$IMAGE_FORMAT" = "ext3" ]; then + livefs_ext2 + else + livefs_squash + fi # LTSP chroot building (only in 32bit and for Edubuntu (DVD)) case $FS in From c88909a98822de9893ee97ff8803648e125670d0 Mon Sep 17 00:00:00 2001 From: Michael Casadevall Date: Mon, 17 May 2010 13:56:52 -0400 Subject: [PATCH 02/10] Actually made ext3 work --- livecd.sh | 68 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/livecd.sh b/livecd.sh index 85fdb58e..2507b339 100755 --- a/livecd.sh +++ b/livecd.sh @@ -21,7 +21,7 @@ set -eu # Boston, MA 02110-1301 USA. # ########################################################################## -# Depends: debootstrap, rsync, python-minimal|python, procps, squashfs-tools, ltsp-server [i386], e2tools +# 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 \ @@ -56,6 +56,36 @@ subst_package() { } +livefs_squash() +{ + squashsort="http://people.ubuntu.com/~tfheen/livesort/${FSS}.list.${TARGETARCH}" + #if wget -O livecd.${FSS}.sort ${squashsort} > /dev/null 2>&1; then + if false; then + echo "Using the squashfs sort list from ${squashsort}." + else + echo "Unable to fetch squashfs sort list; using a blank list." + : > livecd.${FSS}.sort + fi + + # make sure there is no old squashfs idling around + rm -f livecd.${FSS}.squashfs + + mksquashfs ${ROOT} livecd.${FSS}.squashfs -sort livecd.${FSS}.sort + chmod 644 livecd.${FSS}.squashfs +} + +livefs_ext2() +{ + # Add 10MiB extra free space for first boot + ext3 journal + size=$(($(du -sx --block-size=1024 ${ROOT} | cut -f1) + (10240))) + echo "Building ext2 filesystem." + + # remove any stale filesystem images + rm -f livecd.${FSS}.squashfs + + genext2fs -b $size -d ${ROOT} livecd.${FSS}.ext2 +} + if [ $(id -u) != 0 ];then echo "must be run as root" exit 2 @@ -636,41 +666,21 @@ Pin-Priority: 550 # installation progress calculation. printf $(du -sx --block-size=1 ${ROOT} | cut -f1) > livecd.${FSS}.size || true - livefs_squash() - { - squashsort="http://people.ubuntu.com/~tfheen/livesort/${FSS}.list.${TARGETARCH}" - #if wget -O livecd.${FSS}.sort ${squashsort} > /dev/null 2>&1; then - if false; then - echo "Using the squashfs sort list from ${squashsort}." - else - echo "Unable to fetch squashfs sort list; using a blank list." - : > livecd.${FSS}.sort - fi - - # make sure there is no old squashfs idling around - rm -f livecd.${FSS}.squashfs - - mksquashfs ${ROOT} livecd.${FSS}.squashfs -sort livecd.${FSS}.sort - chmod 644 livecd.${FSS}.squashfs - } - - livefs_ext2() - { - size=$(du -sx --block-size=1024 ${ROOT} | cut -f1) - echo "Building ext2 filesystem." - - # remove any stale filesystem images - rm -f livecd.${FSS}.squashfs - - genext2fs -b $size -d ${ROOT} livecd.${FSS}.ext2 - } + # Build our images if [ "$IMAGE_FORMAT" = "ext2" ] || [ "$IMAGE_FORMAT" = "ext3" ]; then livefs_ext2 else livefs_squash fi + # Upgrade ext2->ext3 if that's what is requested + if [ "$IMAGE_FORMAT" = "ext3" ]; then + tune2fs -j livecd.${FSS}.ext2 + mv livecd.${FSS}.ext2 livecd.${FSS}.ext3 + fi +exit + # LTSP chroot building (only in 32bit and for Edubuntu (DVD)) case $FS in edubuntu-dvd) From a9defe1a47a0ed8e3466b20066fa737eb74921bc Mon Sep 17 00:00:00 2001 From: Michael Casadevall Date: Mon, 17 May 2010 14:31:13 -0400 Subject: [PATCH 03/10] fixed spacing in the livefs build code --- debian/changelog | 3 ++- livecd.sh | 39 +++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/debian/changelog b/debian/changelog index 06bdd57e..256a2a75 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,9 @@ livecd-rootfs (1.116) UNRELEASED; urgency=low * added new -f switch for changing image build type * added support for building ext2 and ext3 images in addition to squashfs + * fixed spacing in the livefs build code - -- Michael Casadevall Mon, 17 May 2010 12:47:16 -0400 + -- Michael Casadevall Mon, 17 May 2010 13:59:28 -0400 livecd-rootfs (1.115) maverick; urgency=low diff --git a/livecd.sh b/livecd.sh index 2507b339..9ded55c1 100755 --- a/livecd.sh +++ b/livecd.sh @@ -656,30 +656,29 @@ Pin-Priority: 550 perl -i -nle 'print unless /^Package: language-(pack|support)/ .. /^$/;' \ ${ROOT}/var/lib/apt/extended_states - # And run the cleanup function dead last, to umount /proc after nothing - # else needs to be run in the chroot (umounting it earlier breaks rm): - cleanup + # And run the cleanup function dead last, to umount /proc after nothing + # else needs to be run in the chroot (umounting it earlier breaks rm): + cleanup - # Squashfs does not report unpacked disk space usage, which is explained at - # . However, we would like to cache this - # number for partman's sufficient free space check and ubiquity's - # installation progress calculation. - printf $(du -sx --block-size=1 ${ROOT} | cut -f1) > livecd.${FSS}.size || true + # Squashfs does not report unpacked disk space usage, which is explained at + # . However, we would like to cache this + # number for partman's sufficient free space check and ubiquity's + # installation progress calculation. + printf $(du -sx --block-size=1 ${ROOT} | cut -f1) > livecd.${FSS}.size || true - # Build our images - if [ "$IMAGE_FORMAT" = "ext2" ] || [ "$IMAGE_FORMAT" = "ext3" ]; then - livefs_ext2 - else - livefs_squash - fi + # Build our images + if [ "$IMAGE_FORMAT" = "ext2" ] || [ "$IMAGE_FORMAT" = "ext3" ]; then + livefs_ext2 + else + livefs_squash + fi - # Upgrade ext2->ext3 if that's what is requested - if [ "$IMAGE_FORMAT" = "ext3" ]; then - tune2fs -j livecd.${FSS}.ext2 - mv livecd.${FSS}.ext2 livecd.${FSS}.ext3 - fi -exit + # Upgrade ext2->ext3 if that's what is requested + if [ "$IMAGE_FORMAT" = "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 From 6c1b069004922fc12aa500f3f3db3e576a995e3d Mon Sep 17 00:00:00 2001 From: Michael Casadevall Date: Mon, 17 May 2010 15:34:42 -0400 Subject: [PATCH 04/10] Renamed internal variable from IMAGE_FORMAT to IMAGEFORMAT --- livecd.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/livecd.sh b/livecd.sh index 9ded55c1..e62a2d9a 100755 --- a/livecd.sh +++ b/livecd.sh @@ -148,7 +148,7 @@ EXCLUDE="" LIST="" SUBARCH="" PROPOSED="" -IMAGE_FORMAT="squashfs" +IMAGEFORMAT="squashfs" # must be in the "team / PPA name" form; e.g. "moblin/ppa"; the default PPA # name is "ppa", don't omit it PPA="" @@ -162,7 +162,7 @@ while getopts :d:e:i:I:m:S:s:a:f:p name; do case $name in S) USZ="$OPTARG";; s) SUBARCH="$OPTARG";; a) ARCH="$OPTARG";; - f) IMAGE_FORMAT="$OPTARG";; + f) IMAGEFORMAT="$OPTARG";; p) PROPOSED="yes";; \?) echo bad usage >&2; exit 2;; \:) echo missing argument >&2; exit 2;; @@ -668,14 +668,14 @@ Pin-Priority: 550 # Build our images - if [ "$IMAGE_FORMAT" = "ext2" ] || [ "$IMAGE_FORMAT" = "ext3" ]; then + if [ "$IMAGEFORMAT" = "ext2" ] || [ "$IMAGEFORMAT" = "ext3" ]; then livefs_ext2 else livefs_squash fi # Upgrade ext2->ext3 if that's what is requested - if [ "$IMAGE_FORMAT" = "ext3" ]; then + if [ "$IMAGEFORMAT" = "ext3" ]; then tune2fs -j livecd.${FSS}.ext2 mv livecd.${FSS}.ext2 livecd.${FSS}.ext3 fi From f5c8c36a6cadc9c65c60c820f9118cb5c736549d Mon Sep 17 00:00:00 2001 From: Michael Casadevall Date: Mon, 17 May 2010 15:34:45 -0400 Subject: [PATCH 05/10] extended BuildLiveCD to handle the -f switch --- BuildLiveCD | 8 +++++++- debian/changelog | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/BuildLiveCD b/BuildLiveCD index 62570762..6021321a 100755 --- a/BuildLiveCD +++ b/BuildLiveCD @@ -31,6 +31,7 @@ DEFAULTSUITE="karmic" NEWSUITE="" SUITES="" PROPOSED="" +IMAGEFORMAT="" if [ "$1" = '-s' ]; then shift SUBARCH="$1" @@ -48,6 +49,11 @@ if [ "$1" = '-d' ]; then else NEWSUITE="$DEFAULTSUITE" fi +if [ "$1" = '-f' ]; then + shift + IMAGEFORMAT=$1 + shift +fi for s in $NEWSUITE; do if [ -d build-${s}-live/chroot-${s} ]; then SUITES="$SUITES $s"; fi done @@ -128,7 +134,7 @@ for STE in $SUITES; do rm -f ${PUBDIR}latest ln -sf ${PUBDIR}${NOW} ${PUBDIR}latest mkdir -p ${PUBDIR}${NOW} - if $LINUX32 sudo chroot ${DIR%/./*} sh -c "cd /${DIR#*/./} && /usr/sbin/livecd.sh ${SUBARCHARG} ${PROPOSED} -d${STE} ${ARCHARG} $arg" > ${LOG} 2>&1; then + if $LINUX32 sudo chroot ${DIR%/./*} sh -c "cd /${DIR#*/./} && /usr/sbin/livecd.sh ${SUBARCHARG} ${PROPOSED} -d${STE} ${ARCHARG} ${IMAGEFORMAT} $arg" > ${LOG} 2>&1; then rm -f ${PUBDIR}current ln -sf ${NOW} ${PUBDIR}current diff --git a/debian/changelog b/debian/changelog index 256a2a75..b8cb0aef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ livecd-rootfs (1.116) UNRELEASED; urgency=low * added new -f switch for changing image build type * 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 -- Michael Casadevall Mon, 17 May 2010 13:59:28 -0400 From 2fa3e89b6263c4d66708c059d04c83e74e3d888f Mon Sep 17 00:00:00 2001 From: Michael Casadevall Date: Mon, 17 May 2010 16:30:01 -0400 Subject: [PATCH 06/10] reworked BuildLiveCD command line parsing to be more sane --- BuildLiveCD | 38 ++++++++++++-------------------------- debian/changelog | 1 + 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/BuildLiveCD b/BuildLiveCD index 6021321a..afb598a1 100755 --- a/BuildLiveCD +++ b/BuildLiveCD @@ -27,33 +27,19 @@ fi ARCH=$(dpkg --print-architecture) SUBARCH="" SUBARCHARG="" -DEFAULTSUITE="karmic" -NEWSUITE="" +NEWSUITE="maverick" SUITES="" PROPOSED="" -IMAGEFORMAT="" -if [ "$1" = '-s' ]; then - shift - SUBARCH="$1" - SUBARCHARG="-s$SUBARCH" - shift -fi -if [ "$1" = '-p' ]; then - PROPOSED='-p' - shift -fi -if [ "$1" = '-d' ]; then - shift - NEWSUITE="$1" - shift -else - NEWSUITE="$DEFAULTSUITE" -fi -if [ "$1" = '-f' ]; then - shift - IMAGEFORMAT=$1 - shift -fi +IMAGEFORMAT="squashfs" + +while getopts :s:d:f:p name; do case $name in + s) SUBARCH="$OPTARG";; + d) NEWSUITE="$OPTARG";; + f) IMAGEFORMAT="$OPTARG";; + p) PROPOSED="-p";; +esac; done; +shift $((OPTIND-1)) + for s in $NEWSUITE; do if [ -d build-${s}-live/chroot-${s} ]; then SUITES="$SUITES $s"; fi done @@ -134,7 +120,7 @@ for STE in $SUITES; do rm -f ${PUBDIR}latest ln -sf ${PUBDIR}${NOW} ${PUBDIR}latest mkdir -p ${PUBDIR}${NOW} - if $LINUX32 sudo chroot ${DIR%/./*} sh -c "cd /${DIR#*/./} && /usr/sbin/livecd.sh ${SUBARCHARG} ${PROPOSED} -d${STE} ${ARCHARG} ${IMAGEFORMAT} $arg" > ${LOG} 2>&1; then + if $LINUX32 sudo chroot ${DIR%/./*} sh -c "cd /${DIR#*/./} && /usr/sbin/livecd.sh ${SUBARCHARG} ${PROPOSED} -d${STE} -f${IMAGEFORMAT} ${ARCHARG} ${IMAGEARG} $arg" > ${LOG} 2>&1; then rm -f ${PUBDIR}current ln -sf ${NOW} ${PUBDIR}current diff --git a/debian/changelog b/debian/changelog index b8cb0aef..79226ac4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ livecd-rootfs (1.116) UNRELEASED; urgency=low * 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 -- Michael Casadevall Mon, 17 May 2010 13:59:28 -0400 From f367950cdb9526758236eb9a7f2b3d40699be750 Mon Sep 17 00:00:00 2001 From: Michael Casadevall Date: Wed, 26 May 2010 01:35:52 -0400 Subject: [PATCH 07/10] Changed genext2fs to loopmounting and added support for ext4 --- debian/changelog | 2 +- livecd.sh | 45 +++++++++++++++++++++++++++++---------------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/debian/changelog b/debian/changelog index 79226ac4..c2e5d729 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 and ext3 images in addition to squashfs + * added support for building ext2/ext3/ext4 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 e62a2d9a..8fd31cee 100755 --- a/livecd.sh +++ b/livecd.sh @@ -21,12 +21,13 @@ set -eu # Boston, MA 02110-1301 USA. # ########################################################################## -# Depends: debootstrap, rsync, python-minimal|python, procps, squashfs-tools, ltsp-server [i386], genext2fs +# Depends: debootstrap, rsync, python-minimal|python, procps, squashfs-tools, ltsp-server [i386] 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}; do + ${ROOT}lib/modules/*/volatile ${ROOT}var/{lock,run} \ + `pwd`/mount-livefs; do umount $mnt || true done @@ -74,16 +75,33 @@ livefs_squash() chmod 644 livecd.${FSS}.squashfs } -livefs_ext2() +# 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() { # Add 10MiB extra free space for first boot + ext3 journal - size=$(($(du -sx --block-size=1024 ${ROOT} | cut -f1) + (10240))) - echo "Building ext2 filesystem." + size=$((($(du -sx --block-size=1024 ${ROOT} | cut -f1) + (10240)) * 1024)) + mountpoint=`pwd`/mount-livefs/ + echo "Building $IMAGEFORMAT filesystem." # remove any stale filesystem images - rm -f livecd.${FSS}.squashfs - - genext2fs -b $size -d ${ROOT} livecd.${FSS}.ext2 + 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 } if [ $(id -u) != 0 ];then @@ -668,18 +686,13 @@ Pin-Priority: 550 # Build our images - if [ "$IMAGEFORMAT" = "ext2" ] || [ "$IMAGEFORMAT" = "ext3" ]; then - livefs_ext2 + if [ "$IMAGEFORMAT" = "ext2" ] || [ "$IMAGEFORMAT" = "ext3" ] \ + || [ "$IMAGEFORMAT" = "ext4" ]; then + livefs_ext 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) From 0978c0c7e785f5921103aad843fe77eec059eddf Mon Sep 17 00:00:00 2001 From: Michael Casadevall Date: Wed, 26 May 2010 05:31:53 -0400 Subject: [PATCH 08/10] Backed out loop-mount changes --- debian/changelog | 2 +- livecd.sh | 45 ++++++++++++++++----------------------------- 2 files changed, 17 insertions(+), 30 deletions(-) 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) From 9829c65af037bd9bb30132fb8b6d8bc30cef8ded Mon Sep 17 00:00:00 2001 From: Michael Casadevall Date: Mon, 31 May 2010 19:29:28 -0400 Subject: [PATCH 09/10] Fixed a typo and added a chmod to make the file behavior sane --- livecd.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/livecd.sh b/livecd.sh index 6da94099..ce73eed4 100755 --- a/livecd.sh +++ b/livecd.sh @@ -81,9 +81,10 @@ livefs_ext2() echo "Building ext2 filesystem." # remove any stale filesystem images - rm -f livecd.${FSS}.squashfs + rm -f livecd.${FSS}.ext2 genext2fs -b $size -d ${ROOT} livecd.${FSS}.ext2 + chmod 644 livecd.${FSS}.ext2 } if [ $(id -u) != 0 ];then From 7a34296930548d70e6fabc68133a62dedbfb0d62 Mon Sep 17 00:00:00 2001 From: Michael Casadevall Date: Tue, 1 Jun 2010 10:45:25 -0400 Subject: [PATCH 10/10] Changed the rm that removes state images to a wildcard to successfully remove all stale ext images --- livecd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/livecd.sh b/livecd.sh index ce73eed4..f3bf125d0 100755 --- a/livecd.sh +++ b/livecd.sh @@ -81,7 +81,7 @@ livefs_ext2() echo "Building ext2 filesystem." # remove any stale filesystem images - rm -f livecd.${FSS}.ext2 + rm -f livecd.${FSS}.ext? genext2fs -b $size -d ${ROOT} livecd.${FSS}.ext2 chmod 644 livecd.${FSS}.ext2