Changes

Jump to navigation Jump to search
220 bytes added ,  21:26, 20 August 2012
feedback for copy, dd to device, better cleanup
Line 83: Line 83:  
mkdir $TMPDIR/LiveOS 2>/dev/null
 
mkdir $TMPDIR/LiveOS 2>/dev/null
   −
# Mount, copy, unmount the original root filesystem.
+
# Mount SquashFS, copy out the original root filesystem, unmount SquashFS.
 
SRCMNT=$(mktemp -d /media/XXXXXX)
 
SRCMNT=$(mktemp -d /media/XXXXXX)
 
mount $2 $SRCMNT
 
mount $2 $SRCMNT
 
SQUASHMNT=$(mktemp -d /media/XXXXXX)
 
SQUASHMNT=$(mktemp -d /media/XXXXXX)
 
mount $SRCMNT/LiveOS/squashfs.img $SQUASHMNT
 
mount $SRCMNT/LiveOS/squashfs.img $SQUASHMNT
cp $SQUASHMNT/LiveOS/ext3fs.img $TMPDIR/LiveOS
+
if [[ -x /usr/bin/rsync ]]; then
 +
    rsync --inplace --8-bit-output --progress $SQUASHMNT/LiveOS/ext3fs.img \
 +
                                              $TMPDIR/LiveOS
 +
else
 +
    cp $SQUASHMNT/LiveOS/ext3fs.img $TMPDIR/LiveOS
 +
fi
 
umount $SQUASHMNT
 
umount $SQUASHMNT
   Line 124: Line 129:     
# Reset overlay.
 
# Reset overlay.
dd if=/dev/zero of=$SRCMNT/LiveOS/overlay-* bs=64k count=1 conv=notrunc,fsync
+
dd if=/dev/zero of=$OVDEV bs=64k count=1 conv=notrunc,fsync
    
# Clean up.
 
# Clean up.
 +
sleep 2
 +
losetup -d $OVDEV $FSDEV
 
umount $SRCMNT
 
umount $SRCMNT
 
rmdir $SQUASHMNT $SRCMNT</nowiki>
 
rmdir $SQUASHMNT $SRCMNT</nowiki>

Navigation menu