qubes-linux-template-builder/prepare_image

52 lines
848 B
Plaintext
Raw Normal View History

2010-06-18 23:41:29 +00:00
#!/bin/sh
export IMG=$1
2010-06-18 23:41:29 +00:00
2011-09-25 20:41:27 +00:00
RETCODE=0
: ${DIST=fc14}
. ./builder_setup
2013-02-16 20:06:11 +00:00
set -e
if ! [ $# -eq 1 ]; then
echo "usage $0 <img_file_name>"
2010-06-18 23:41:29 +00:00
exit
fi
if [ "$VERBOSE" == "1" ]; then
export YUM_OPTS="$YUM_OPTS -q"
fi
2010-06-18 23:41:29 +00:00
echo "-> Preparing instalation of $DIST template..."
$SCRIPTSDIR/00_prepare.sh
2010-06-18 23:41:29 +00:00
if [ -f $IMG ]; then
echo "-> Image file already exists, assuming *update*..."
mount -o loop $IMG mnt || exit 1
export INSTALLDIR=`pwd`/mnt/
2010-06-18 23:41:29 +00:00
else
echo "-> Initializing empty image..."
truncate -s 10G $IMG || exit 1
2010-06-18 23:41:29 +00:00
echo "-> Creating filesystem..."
mkfs.ext4 -q -F $IMG || exit 1
2010-06-18 23:41:29 +00:00
mkdir -p mnt
mount -o loop $IMG mnt || exit 1
2010-06-18 23:41:29 +00:00
export INSTALLDIR=`pwd`/mnt/
2010-06-18 23:41:29 +00:00
$SCRIPTSDIR/01_install_core.sh
2010-06-18 23:41:29 +00:00
fi
echo "-> Installing package groups..."
$SCRIPTSDIR/02_install_groups.sh
2010-06-18 23:41:29 +00:00
2013-02-16 20:18:20 +00:00
echo "-> Unmounting prepared_image..."
sudo umount $INSTALLDIR
2011-09-25 20:41:27 +00:00
exit $RETCODE