-#!/bin/bash
+#!/usr/bin/env bash
# Filename: grml2iso
# Purpose: create a multiboot grml ISO using grml2usb
# Authors: Michael Prokop <mika@grml.org>,
[ -n "$GRML2USB" ] || GRML2USB='grml2usb'
# work directory for creating the filesystem
[ -n "$WRKDIR" ] || WRKDIR='/tmp/grml2iso.tmp'
+# support mkisofs as well as genisoimage
+ if which mkisofs >/dev/null 2>&1; then
+ MKISOFS='mkisofs'
+ elif which genisoimage >/dev/null 2>&1; then
+ MKISOFS='genisoimage'
+ else
+ echo >&2 "Error: neither mkisofs nor genisoimage available - can not create ISO."
+ exit 1
+fi
# }}}
# helper stuff {{{
-b Boot Params Additional boot parameters passed to grml2usb
-c Directory Copy files from directory to generated iso
-f Force overwrite of existing target.iso
+ -r BootParam Remove specified boot params.
+ Could be specfied multiple times.
"
[ -n "$1" ] && exit $1 || exit 1
}
ISOFILE=''
DIR=''
- GRML2USB_PARAMS=''
+ ADD_OPTS=''
FORCE=''
- while getopts fb:c:o: name; do
+ typeset -a REMOVE_OPTS
+ while getopts fb:c:o:r: name; do
case $name in
o) ISOFILE="$OPTARG";;
- b) GRML2USB_PARAMS='--bootoptions='"${OPTARG}";;
+ b) ADD_OPTS="--bootoption="$OPTARG"";;
c) DIR="$OPTARG";;
f) FORCE='true';;
+ r) REMOVE_OPTS+=(--remove-bootoption="$OPTARG");;
?) usage 2;;
esac
done
# }}}}
# execute grml2usb with all ISOs you'd like to install {{{
- $GRML2USB "${GRML2USB_PARAMS}" "$@" "$WRKDIR/cddir"
+ $GRML2USB "${REMOVE_OPTS[@]}" ${ADD_OPTS:+"$ADD_OPTS"} "$@" "$WRKDIR/cddir"
# }}}
# move syslinux to isolinux {{{
# }}}
# generate the CD/DVD ISO {{{
- mkisofs -V 'grml-multiboot' -l -r -J -no-pad \
+ $MKISOFS -V 'grml-multiboot' -l -r -J -no-pad \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
-o "$ISOFILE" .