+# }}}
+
+# helper stuff {{{
+ set -e
+
+ usage() {
+ echo >&2 "Usage: $0 [OPTIONS] -o target.iso source1.iso [source2.iso ...]"
+ echo >&2 "
+Options:
+ -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.
+ -p <grml2usb param> Add the specified parameter to the grml2usb
+ commandline. For a list of valid parameters have
+ a look at the grml2usb manpage.
+ Can be specified multiple times.
+ -s URI Generate a small ISO file which downloads the squashfs
+ file from the specified URI. Please note that due to
+ restrictions in the bootprocess only IPs are allowed.
+ Supported protocols are: http and ftp
+
+ Examples:
+ $0 -s http://192.168.23.42:8000/grml/ -o small.iso grml64_2010.12.iso
+
+ Will generate a file small.iso which tries to download the squashfs file from
+ http://192.168.23.42:8000/grml/ - the squashfs file is placed in the same
+ output directory as the ISO file.
+"
+ [ -n "$1" ] && exit $1 || exit 1
+ }
+# }}}
+
+# command line handling {{{
+ [[ $# -gt 2 ]] || usage 1
+
+ ISOFILE=''
+ DIR=''
+ ADD_OPTS=''
+ FORCE=''
+ URI=''
+ typeset -a GRML2USB_OPTS
+ while getopts fb:c:o:r:p:s: name; do
+ case $name in
+ o) ISOFILE="$OPTARG";;
+ b) GRML2USB_OPTS+=(--bootoptions="$OPTARG");;
+ c) DIR="$OPTARG";;
+ f) FORCE='true';;
+ r) GRML2USB_OPTS+=(--remove-bootoption="$OPTARG");;
+ p) GRML2USB_OPTS+=("$OPTARG");;
+ s) URI="$OPTARG";;
+ ?) usage 2;;
+ esac
+ done
+ # test for specified URI
+ if [ -n "$URI" ] ; then
+ GRML2USB_OPTS+=(--bootoptions="fetch=$URI")
+ fi