From 5c5354fa91f3c1eb7140223a4cc66af4d9beb804 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 29 Nov 2013 22:25:16 -0800 Subject: [PATCH] Add mkiso script mkiso converts an image into ISO/Joliet compatible format suitable for burning onto a CD/DVD and having it cross-compatible with Win/OSX/*NIX --- mkiso | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 mkiso diff --git a/mkiso b/mkiso new file mode 100755 index 0000000..f61a0fa --- /dev/null +++ b/mkiso @@ -0,0 +1,71 @@ +#!/bin/bash +# Make an ISO/Joliet compatible image from a CDR image on OS X + +APP=$(echo $0 | sed 's#^.*/##') + +usage() +{ + echo " +$APP converts an image into ISO/Joliet compatible format suitable for +burning onto a CD/DVD and having it cross-compatible with Win32/OSX/*NIX + +Usage: $APP [-o ] +" +} + +while getopts :ho: OPTION +do + case $OPTION in + h) + # Help + usage + exit 0 + ;; + + o) + # Output file + OUTFILE=$OPTARG + ;; + + :) + # Missing required argument + echo "$APP: Missing argument for option -$OPTARG" >&2 + exit 1 + ;; + + \?) + # Invalid option + echo "$APP: Invalid option: -$OPTARG" >&2 + exit 1 + ;; + esac +done + +# Shift away the options +shift $(($OPTIND - 1)) + +INFILE=$1 + +if [[ -z $INFILE ]] +then + usage + exit 1 +fi + +if [[ ! -r $INFILE ]] +then + echo "$APP: Unable to read input file $INFILE" >&2 + exit 1 +fi + +if [[ -z $OUTFILE ]] +then + OUTFILE=$(echo $INFILE | sed -E 's#\.[^\.]+$#\.iso#') +fi + +echo "Input file = $INFILE" +echo "Output file = $OUTFILE" + +hdiutil makehybrid -iso -joliet -o "$OUTFILE" "$INFILE" + +exit $?