refactor in light of non-savings of rsync work

ubuntu/precise
LaMont Jones 20 years ago
parent 095412ea30
commit 813724f6a5

@ -40,7 +40,7 @@ IMG=livecd.fsimg
MOUNTS="${ROOT}dev/pts ${ROOT}dev/shm ${ROOT}.dev ${ROOT}dev ${ROOT}proc" MOUNTS="${ROOT}dev/pts ${ROOT}dev/shm ${ROOT}.dev ${ROOT}dev ${ROOT}proc"
DEV="" DEV=""
rm -rf ${ROOT} rm -rf ${ROOT} $(pwd)/${IMG}-*
mkdir -p ${ROOT}var/cache/debconf mkdir -p ${ROOT}var/cache/debconf
cat << @@EOF > ${ROOT}var/cache/debconf/config.dat cat << @@EOF > ${ROOT}var/cache/debconf/config.dat
@ -141,15 +141,15 @@ deb-src http://archive.ubuntu.com/ubuntu $STE main restricted
# deb http://archive.ubuntu.com/ubuntu $STE universe # deb http://archive.ubuntu.com/ubuntu $STE universe
# deb-src http://archive.ubuntu.com/ubuntu $STE universe # deb-src http://archive.ubuntu.com/ubuntu $STE universe
# deb http://security.ubuntu.com/ubuntu ${STE}-security main restricted deb http://security.ubuntu.com/ubuntu ${STE}-security main restricted
# deb-src http://security.ubuntu.com/ubuntu ${STE}-security main restricted deb-src http://security.ubuntu.com/ubuntu ${STE}-security main restricted
@@EOF @@EOF
mv ${ROOT}etc/apt/trusted.gpg.$$ ${ROOT}etc/apt/trusted.gpg mv ${ROOT}etc/apt/trusted.gpg.$$ ${ROOT}etc/apt/trusted.gpg
# get rid of the .debs - we don't need them. # get rid of the .debs - we don't need them.
chroot ${ROOT} apt-get clean chroot ${ROOT} apt-get clean
rm ${ROOT}var/lib/apt/lists/*_* rm -f ${ROOT}var/lib/apt/lists/*_*
rm ${ROOT}var/spool/postfix/maildrop/* rm -f ${ROOT}var/spool/postfix/maildrop/*
mkdir -p livecd.mnt mkdir -p livecd.mnt
MOUNTS="$MOUNTS $(pwd)/livecd.mnt" MOUNTS="$MOUNTS $(pwd)/livecd.mnt"
@ -160,20 +160,21 @@ SZ=$(python -c "print int($(du -sk $ROOT|sed 's/[^0-9].*$//')*1.1+$USZ)")
(( SZ > 2097150 )) && SZ=2097150 (( SZ > 2097150 )) && SZ=2097150
SZ=2097150 # XXX fix size for now SZ=2097150 # XXX fix size for now
for fsbs in 4096:4096 1024:65536; do for fsbs in 1024:65536; do
FSBLOCK=${fsbs%:*} FSBLOCK=${fsbs%:*}
COMP=${fsbs#*:} COMP=${fsbs#*:}
IMGNAME=${IMG}.${fsbs} IMGNAME=${IMG}-${FSBLOCK}
rm -f $IMGNAME if [ ! -f ${IMGNAME} ]; then
dd if=/dev/zero of=$IMGNAME seek=$SZ bs=1024 count=1 dd if=/dev/zero of=$IMGNAME seek=$SZ bs=1024 count=1
INUM="" INUM=""
[ -n "$UINUM" ] && INUM="-N "$(python -c "print $(find ${ROOT}|wc -l)+$UINUM") || INUM="" [ -n "$UINUM" ] && INUM="-N "$(python -c "print $(find ${ROOT}|wc -l)+$UINUM") || INUM=""
mke2fs -b $FSBLOCK $INUM -Osparse_super -F $IMGNAME mke2fs -b $FSBLOCK $INUM -Osparse_super -F $IMGNAME
losetup $DEV $IMGNAME losetup $DEV $IMGNAME
mount $DEV livecd.mnt mount $DEV livecd.mnt
rsync -a ${ROOT} livecd.mnt rsync -a ${ROOT} livecd.mnt
umount $DEV umount $DEV
losetup -d $DEV losetup -d $DEV
fi
create_compressed_fs $IMGNAME $COMP > livecd.cloop-${fsbs} create_compressed_fs $IMGNAME $COMP > livecd.cloop-${fsbs}
done done

Loading…
Cancel
Save