2010-06-18 23:41:29 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-01-25 08:03:51 +00:00
|
|
|
export IMG=$1
|
2010-06-18 23:41:29 +00:00
|
|
|
|
2011-09-25 20:41:27 +00:00
|
|
|
RETCODE=0
|
|
|
|
|
2011-09-24 09:58:14 +00:00
|
|
|
: ${DIST=fc14}
|
|
|
|
|
2013-01-25 08:03:51 +00:00
|
|
|
if ! [ $# -eq 1 ]; then
|
|
|
|
echo "usage $0 <img_file_name>"
|
2010-06-18 23:41:29 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2012-11-18 03:01:49 +00:00
|
|
|
if [ "$VERBOSE" == "1" ]; then
|
2013-01-25 08:03:51 +00:00
|
|
|
export YUM_OPTS="$YUM_OPTS -q"
|
2012-11-18 03:01:49 +00:00
|
|
|
fi
|
2010-06-18 23:41:29 +00:00
|
|
|
|
|
|
|
if [ -f $IMG ]; then
|
|
|
|
echo "-> Image file already exists, assuming *update*..."
|
2011-03-19 02:30:23 +00:00
|
|
|
mount -o loop $IMG mnt || exit 1
|
2013-01-25 08:03:51 +00:00
|
|
|
export INSTALLDIR=`pwd`/mnt/
|
2010-06-18 23:41:29 +00:00
|
|
|
else
|
|
|
|
|
2011-09-24 09:58:14 +00:00
|
|
|
echo "-> Preparing instalation of $DIST template..."
|
2013-01-25 08:03:51 +00:00
|
|
|
scripts_"${DIST}"/00_prepare.sh
|
2011-09-24 09:58:14 +00:00
|
|
|
|
2011-03-19 02:30:23 +00:00
|
|
|
echo "-> Initializing empty image..."
|
|
|
|
truncate -s 10G $IMG || exit 1
|
2010-06-18 23:41:29 +00:00
|
|
|
|
2011-03-19 02:30:23 +00:00
|
|
|
echo "-> Creating filesystem..."
|
2012-11-14 15:50:28 +00:00
|
|
|
mkfs.ext4 -q -F $IMG || exit 1
|
2010-06-18 23:41:29 +00:00
|
|
|
|
|
|
|
mkdir -p mnt
|
2011-03-19 02:30:23 +00:00
|
|
|
mount -o loop $IMG mnt || exit 1
|
2010-06-18 23:41:29 +00:00
|
|
|
|
2013-01-25 08:03:51 +00:00
|
|
|
export INSTALLDIR=`pwd`/mnt/
|
2010-06-18 23:41:29 +00:00
|
|
|
|
2013-01-25 08:03:51 +00:00
|
|
|
scripts_"${DIST}"/01_install_core.sh
|
2010-06-20 20:16:30 +00:00
|
|
|
|
2010-06-18 23:41:29 +00:00
|
|
|
fi
|
|
|
|
|
2013-01-25 08:03:51 +00:00
|
|
|
export PKGGROUPS=$(cat scripts_"${DIST}/packages.list")
|
|
|
|
|
2010-06-18 23:41:29 +00:00
|
|
|
echo "-> Installing package groups..."
|
2013-01-25 08:03:51 +00:00
|
|
|
scripts_"${DIST}"/02_install_groups.sh
|
2010-06-18 23:41:29 +00:00
|
|
|
|
2013-01-25 08:03:51 +00:00
|
|
|
echo "-> Unmounting fedorized_image..."
|
|
|
|
sudo umount $INSTALLDIR
|
2011-09-25 20:41:27 +00:00
|
|
|
|
|
|
|
exit $RETCODE
|