Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwlive.git;a=commitdiff;h=a641ec27fd0357e99bee7f5feeb46e0bad0e29ab
commit a641ec27fd0357e99bee7f5feeb46e0bad0e29ab Author: James Buren <[email protected]> Date: Mon Feb 18 00:03:18 2013 -0600 redesign create-root to create a virtual ext4 disk diff --git a/new/create-root b/new/create-root index fc8e60e..fcd4944 100755 --- a/new/create-root +++ b/new/create-root @@ -9,6 +9,12 @@ if [ "$(id -u)" -ne 0 ]; then exit 1 fi +# Create the virtual disk and mount it. +dd if=/dev/zero of=rootfs.img bs=$(( 128 * 1024 )) count=$(( (4096 * 1024 * 1024) / (128 * 1024) )) +mkfs.ext4 -q -F rootfs.img +mkdir -p $ROOT +mount -o loop rootfs.img $ROOT + # Create root directory skeleton. mkdir -p $ROOT/{dev,proc,sys,tmp,var/tmp,var/cache/pacman-g2} mount -t devtmpfs none $ROOT/dev @@ -57,16 +63,19 @@ EOF cp /proc/mounts mounts while read line; do path=$(echo $line | cut -f 2 -d ' ') + if [ "$path" = "$ROOT" ]; then + continue + fi if [ "$path" != "${path#$ROOT}" ]; then umount $path fi done < mounts -rm -f mounts +umount $ROOT -# Generate the files needed for ISO. -mksquashfs $ROOT rootfs -noappend -comp gzip -cp $ROOT/boot/vmlinuz vmlinuz -cp $ROOT/boot/initrd initrd +# Now shrink the rootfs.img to minimum size. +e2fsck -f rootfs.img +resize2fs -M rootfs.img +e2fsck -f rootfs.img -# Delete the root directory. -rm -rf $ROOT +# Clean up leftovers. +rm -rf mounts $ROOT _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
