qubes-linux-template-builder/cleanup_image
Marek Marczykowski add64aa2e4 Support different versions of the same distribution
Split $DIST to distribution name and version (builder_setup script) and search
for scripts first $DIST-specific, but then for given distribution.

Also move out some Fedora-specific things to scripts_fc17.
2013-02-16 21:21:05 +01:00

34 lines
480 B
Bash
Executable File

#!/bin/sh
export IMG=$1
. ./builder_setup
set -e
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
mount -o loop $IMG mnt || exit 1
export INSTALLDIR=`pwd`/mnt/
$SCRIPTSDIR/09_cleanup.sh
echo "--> Compacting image file..."
dd if=/dev/zero of=mnt/fillme bs=1M > /dev/null 2>&1 || true
sync
rm mnt/fillme
umount mnt
cp --sparse=always $IMG $IMG.new
mv $IMG.new $IMG
ls -als $IMG