2010-09-17 16:08:12 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
IMG=$1
|
|
|
|
|
|
|
|
if ! [ $# -eq 1 ]; then
|
|
|
|
echo "usage $0 <img_file_name>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if ! [ -f $IMG ]; then
|
|
|
|
echo $IMG does not exist
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
ls -als $IMG
|
2011-03-19 02:30:23 +00:00
|
|
|
mount -o loop $IMG mnt || exit 1
|
2010-09-17 16:08:12 +00:00
|
|
|
INSTALLDIR=`pwd`/mnt/
|
|
|
|
yum clean packages --installroot=$INSTALLDIR
|
|
|
|
dd if=/dev/zero of=mnt/fillme bs=1M
|
|
|
|
sync
|
|
|
|
rm mnt/fillme
|
|
|
|
umount mnt
|
|
|
|
cp --sparse=always $IMG $IMG.new
|
|
|
|
mv $IMG.new $IMG
|
|
|
|
ls -als $IMG
|
|
|
|
|