qubes-linux-template-builder/fedorize_image
Olivier Medoc 7e17847377 template_builder: made make scripts OS independent.
An important note is that each OS script need to setup itself its own chroot environment (like creating /proc...).
2013-02-06 02:53:30 +01:00

51 lines
980 B
Bash
Executable File

#!/bin/sh
export IMG=$1
RETCODE=0
: ${DIST=fc14}
if ! [ $# -eq 1 ]; then
echo "usage $0 <img_file_name>"
exit
fi
if [ "$VERBOSE" == "1" ]; then
export YUM_OPTS="$YUM_OPTS -q"
fi
if [ -f $IMG ]; then
echo "-> Image file already exists, assuming *update*..."
mount -o loop $IMG mnt || exit 1
export INSTALLDIR=`pwd`/mnt/
else
echo "-> Preparing instalation of $DIST template..."
scripts_"${DIST}"/00_prepare.sh
echo "-> Initializing empty image..."
truncate -s 10G $IMG || exit 1
echo "-> Creating filesystem..."
mkfs.ext4 -q -F $IMG || exit 1
mkdir -p mnt
mount -o loop $IMG mnt || exit 1
export INSTALLDIR=`pwd`/mnt/
scripts_"${DIST}"/01_install_core.sh
fi
export PKGGROUPS=$(cat scripts_"${DIST}/packages.list")
echo "-> Installing package groups..."
scripts_"${DIST}"/02_install_groups.sh
echo "-> Unmounting fedorized_image..."
sudo umount $INSTALLDIR
exit $RETCODE