switch ext2 image creation to use loop mounting instead of genext2fs

ubuntu/precise
Oliver Grawert 15 years ago
parent 9f58353e84
commit 2bd2e11e5a

7
debian/changelog vendored

@ -1,8 +1,13 @@
livecd-rootfs (1.139) UNRELEASED; urgency=low livecd-rootfs (1.139) UNRELEASED; urgency=low
[ Steve Langasek ]
* One more undefined variable fix for set -u * One more undefined variable fix for set -u
-- Steve Langasek <steve.langasek@ubuntu.com> Wed, 21 Jul 2010 11:10:44 +0200 [ Oliver Grawert ]
* drop genext2fs, it is simply to slow, instead we use a loop munted ext2
image now.
-- Oliver Grawert <ogra@ubuntu.com> Wed, 21 Jul 2010 15:12:18 +0200
livecd-rootfs (1.138) maverick; urgency=low livecd-rootfs (1.138) maverick; urgency=low

2
debian/control vendored

@ -8,7 +8,7 @@ Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-core-dev/livecd-rootfs/trunk
Package: livecd-rootfs Package: livecd-rootfs
Architecture: all Architecture: all
Depends: ${misc:Depends}, debootstrap, rsync, python-minimal | python, procps, squashfs-tools (>= 1:3.3-1), grep-dctrl, fdupes, lsb-release, lzma, genext2fs Depends: ${misc:Depends}, debootstrap, rsync, python-minimal | python, procps, squashfs-tools (>= 1:3.3-1), grep-dctrl, fdupes, lsb-release, lzma, e2fsprogs
Suggests: partimage Suggests: partimage
Description: construction script for the livecd rootfs Description: construction script for the livecd rootfs
livecd-rootfs provides the script used to create the root filesystem livecd-rootfs provides the script used to create the root filesystem

@ -21,7 +21,7 @@ set -eu
# Boston, MA 02110-1301 USA. # # 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], e2fsprogs
cleanup() { cleanup() {
for mnt in ${ROOT}dev/pts ${ROOT}dev/shm ${ROOT}.dev ${ROOT}dev \ for mnt in ${ROOT}dev/pts ${ROOT}dev/shm ${ROOT}.dev ${ROOT}dev \
@ -30,7 +30,7 @@ cleanup() {
umount $mnt || true umount $mnt || true
done done
[ -n "$DEV" ] && losetup -d $DEV || true [ -n "$DEV" ] && umount $DEV && losetup -d $DEV || true
grep ${ROOT} /proc/mounts && return 1 || return 0 grep ${ROOT} /proc/mounts && return 1 || return 0
} }
@ -78,12 +78,25 @@ livefs_ext2()
{ {
# Add 10MiB extra free space for first boot + ext3 journal # Add 10MiB extra free space for first boot + ext3 journal
size=$(($(du -ks ${ROOT} | cut -f1) + (10240))) size=$(($(du -ks ${ROOT} | cut -f1) + (10240)))
MOUNTPOINT=$(mktemp -d)
DEV=$(losetup -f)
echo "Building ext2 filesystem." echo "Building ext2 filesystem."
# remove any stale filesystem images # remove any stale filesystem images
rm -f livecd.${FSS}.ext? rm -f livecd.${FSS}.ext?
genext2fs -b $size -d ${ROOT} livecd.${FSS}.ext2 # create an empty ext2 image and loop mount it
dd if=/dev/zero of=livecd.${FSS}.ext2 bs=1024 count=0 seek=$size
mke2fs livecd.${FSS}.ext2
mount -o loop=${DEV} livecd.${FSS}.ext2 ${MOUNTPOINT}
# copy chroot content to image
cp -a ${ROOT} ${MOUNTPOINT}
# clean up
umount ${MOUNTPOINT}
rm -rf ${MOUNTPOINT}
losetup -d $DEV
chmod 644 livecd.${FSS}.ext2 chmod 644 livecd.${FSS}.ext2
} }

Loading…
Cancel
Save