qubes-linux-template-builder/fedorize_image

48 lines
1.1 KiB
Plaintext
Raw Normal View History

2010-06-18 23:41:29 +00:00
#!/bin/sh
IMG=$1
PKGLISTFILE=$2
if ! [ $# -eq 2 ]; then
echo "usage $0 <img_file_name> <package_list>"
exit
fi
if [ -f $IMG ]; then
echo "-> Image file already exists, assuming *update*..."
mount -o loop $IMG mnt || exit 1
2010-06-18 23:41:29 +00:00
INSTALLDIR=`pwd`/mnt/
else
echo "-> Initializing empty image..."
truncate -s 10G $IMG || exit 1
2010-06-18 23:41:29 +00:00
echo "-> Creating filesystem..."
mkfs.ext4 -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
INSTALLDIR=`pwd`/mnt/
echo "-> Initializing RPM database..."
rpm --initdb --root=$INSTALLDIR
rpm --import --root=$INSTALLDIR keys/*
echo "-> Installing core RPM packages..."
rpm -i --root=$INSTALLDIR base_rpms/setup-*.rpm
rpm -i --root=$INSTALLDIR base_rpms/filesystem-*.rpm
rpm -i --root=$INSTALLDIR base_rpms/fedora-release-*.rpm
cp clean_images/network $INSTALLDIR/etc/sysconfig
cp clean_images/resolv.conf $INSTALLDIR/etc
2010-06-18 23:41:29 +00:00
fi
PKGGROUPS=$(cat $PKGLISTFILE)
echo "-> Installing package groups..."
2010-10-01 13:39:00 +00:00
yum install -y --installroot=$INSTALLDIR $PKGGROUPS
2010-06-18 23:41:29 +00:00
umount mnt