cleanup_image improvements

This commit is contained in:
Marek Marczykowski 2012-06-06 02:54:10 +02:00
parent 5d20d57bc8
commit a306aa7dbc

View File

@ -17,13 +17,15 @@ fi
ls -als $IMG
mount -o loop $IMG mnt || exit 1
INSTALLDIR=`pwd`/mnt/
rm -f $INSTALLDIR/var/lib/rpm/__db.00* $INSTALLDIR/var/lib/rpm/.rpm.lock
yum -c $PWD/yum.conf clean packages --installroot=$INSTALLDIR
# Make sure that rpm database has right format (for rpm version in template, not host)
echo "--> Rebuilding rpm database..."
chroot `pwd`/mnt /bin/rpm --rebuilddb
dd if=/dev/zero of=mnt/fillme bs=1M || true
echo "--> Compacting image file..."
dd if=/dev/zero of=mnt/fillme bs=1M 2> /dev/null || true
sync
rm mnt/fillme
umount mnt