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
master
nirenjan 2013-11-29 22:25:16 -08:00
parent 8b8b485086
commit 5c5354fa91
1 changed files with 71 additions and 0 deletions

71
mkiso 100755
View File

@ -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 <output file>] <input file>
"
}
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 $?