Rework image creation

Allow for grub, grub-gfx, or isolinux support
(isolinux support still pending, skeleton is in place)

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
This commit is contained in:
Aaron Griffin 2008-10-20 23:41:05 -05:00
parent c8df7387dd
commit 071b3454a0

View File

@ -178,41 +178,60 @@ command_image () {
fi fi
cp "${MOUNTFILE}" "${work_dir}/mounts" cp "${MOUNTFILE}" "${work_dir}/mounts"
USE_GRUB=1
bootflags="" bootflags=""
if [ "$USE_GRUB" = "1" ]; then if [ "$PKGLIST" = "grub" -o "$PKGLIST" = "grub-gfx" ]; then
_pacman grub #grub-gfx ?? #test for either (eww, gross)
mkdir -p "${work_dir}/boot/grub" tst=0
cp "${work_dir}/usr/lib/grub/i386-pc/*" "${work_dir}/boot/grub" pacman -Qi grub 2>&1 >/dev/null
tst=$(($tst + $?))
# copy over kernel and grub configs for boot pacman -Qi grub-gfx 2>&1 >/dev/null
if [ -d "${work_dir}/boot" -a -e "${DEF_CONFIG_DIR}/boot" ]; then tst=$(($tst + $?))
rm -rf "${work_dir}/boot" if [ $tst -ge 2 ]; then
cp -r "${work_dir}/boot" "${work_dir}" echo "grub or grub-gfx not found on host system. Cannot install!"
cp -rf "${DEF_CONFIG_DIR}/boot" "${work_dir}" exit 1
fi fi
bootflags="boot/grub/stage2_eltorito"
mkdir -p "${work_dir}/boot/grub/"
cp -r /usr/lib/grub/i386-pc/* "${work_dir}/boot/grub"
#TODO remove other grub cruft?
bootflags="-b boot/grub/stage2_eltorito"
elif [ "$PKGLIST" = "isolinux" ]; then
if ! pacman -Qi $PKGLIST 2>&1 >/dev/null; then
echo "$PKGLIST not found on host system. Cannot install!"
exit 1
fi
mkdir -p "${work_dir}/boot/isolinux"
cp /usr/lib/isolinux/* "${work_dir}/boot/isolinux"
#TODO remove other isolinux cruft?
bootflags="-b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat"
else else
_pacman isolinux echo "No bootloader specified. Use the -p flag to specify"
bootflags="boot/whatever/isolinux" echo " Supported Bootloaders:"
echo " grub"
echo " grub-gfx"
echo " isolinux"
exit 1
fi fi
if [ "x$IMG_TYPE" == "xdisk" ]; then if [ "$IMG_TYPE" = "disk" ]; then
echo "Creating DISK image..." echo "Creating DISK image..."
mkusbimg "${work_dir}" "${imgname}" mkusbimg "${work_dir}" "${imgname}"
else elif [ "$IMG_TYPE" = "iso" ]; then
echo "Creating ISO image..." echo "Creating ISO image..."
if [ -z "$bootflags" ]; then
echo "Eeek, no boot flags found. This probably won't be bootable"
fi
qflag="" qflag=""
[ "${QUIET}" = "y" ] && qflag="-q" #[ "${QUIET}" = "y" ] && qflag="-q"
mkisofs ${qflag} -r -l $bootflags -uid 0 -gid 0 \ mkisofs ${qflag} -r -l $bootflags -uid 0 -gid 0 \
-input-charset utf-8 -p "prepared by mkarchiso" \
-no-emul-boot -boot-load-size 4 -boot-info-table \ -no-emul-boot -boot-load-size 4 -boot-info-table \
-publisher "Arch Linux <archlinux.org>" \ -publisher "ArchLinux <archlinux.org>" \
-input-charset=UTF-8 -p "prepared by mkarchiso" \ -A "ArchLinux Live/Rescue CD" \
-A "Arch Linux Live/Rescue CD" \
-o "${imgname}" "${work_dir}" -o "${imgname}" "${work_dir}"
else
echo "Invalid image type '$IMG_TYPE' specified"
exit 1
fi fi
} }