qubes-linux-template-builder/fedorize_image
2010-06-19 02:27:12 +02:00

44 lines
1.0 KiB
Bash
Executable File

#!/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,offset=$((63*512)) $IMG mnt || exit 1
INSTALLDIR=`pwd`/mnt/
else
echo "-> Initializing empty image with part table and filesystems..."
cp clean_images/clean-starter.img $IMG
touch $IMG || exit 1
mkdir -p mnt
mount -o loop,offset=$((63*512)) $IMG mnt || exit 1
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
fi
PKGGROUPS=$(cat $PKGLISTFILE)
echo "-> Installing package groups..."
yum install --installroot=$INSTALLDIR $PKGGROUPS
umount mnt