From 1de1d754a19aa55a4857289e42fcdadae70c9947 Mon Sep 17 00:00:00 2001 From: LaMont Jones Date: Fri, 21 Jan 2005 15:52:40 +0000 Subject: [PATCH] Much more rsyncable now --- debian/control | 2 +- livecd.sh | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/debian/control b/debian/control index e11954f4..506a042b 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.6.1.0 Package: livecd-rootfs Architecture: all -Depends: sudo, debootstrap, rsync, cloop-utils, python-minimal|python +Depends: sudo, debootstrap, rsync, cloop-utils, python-minimal|python, partimage Description: construction script for the livecd rootfs livecd-rootfs provides the script used to create the root filesystem on the livecd. diff --git a/livecd.sh b/livecd.sh index 2a20f30e..6f20d249 100755 --- a/livecd.sh +++ b/livecd.sh @@ -40,7 +40,7 @@ IMG=livecd.fsimg MOUNTS="${ROOT}dev/pts ${ROOT}dev/shm ${ROOT}.dev ${ROOT}dev ${ROOT}proc" DEV="" -rm -rf ${ROOT} $(pwd)/${IMG}-* +rm -rf ${ROOT} mkdir -p ${ROOT}var/cache/debconf cat << @@EOF > ${ROOT}var/cache/debconf/config.dat @@ -172,15 +172,24 @@ for fsbs in 1024:65536; do COMP=${fsbs#*:} IMGNAME=${IMG}-${FSBLOCK} if [ ! -f ${IMGNAME} ]; then - dd if=/dev/zero of=$IMGNAME count=$SZ bs=1M - INUM="" - [ -n "$UINUM" ] && INUM="-N "$(python -c "print $(find ${ROOT}|wc -l)+$UINUM") || INUM="" - mke2fs -b $FSBLOCK $INUM -Osparse_super -F $IMGNAME - losetup $DEV $IMGNAME + if [ -f old-${IMGNAME} ]; then + cp old-${IMGNAME} new-${IMGNAME} + else + dd if=/dev/zero of=new-${IMGNAME} count=$SZ bs=1M + INUM="" + [ -n "$UINUM" ] && INUM="-N "$(python -c "print $(find ${ROOT}|wc -l)+$UINUM") || INUM="" + mke2fs -b $FSBLOCK $INUM -Osparse_super -F new-${IMGNAME} + fi + losetup $DEV new-${IMGNAME} mount $DEV livecd.mnt - rsync -a ${ROOT} livecd.mnt + rsync -a --delete --inplace --no-whole-file ${ROOT} livecd.mnt umount $DEV + rm -rf partimg-${IMGNAME}.* + partimage -b -z0 --nodesc -f3 -c -o -y save $DEV partimg-${IMGNAME} + cat partimg-${IMGNAME}.*|partimage -b -z0 --nodesc -e -f3 -c -o -y restore $DEV stdin losetup -d $DEV + mv new-${IMGNAME} ${IMGNAME} + cp ${IMGNAME} old-${IMGNAME} fi create_compressed_fs $IMGNAME $COMP > livecd.cloop-${fsbs} done