-d [directory] Create a data CD using the given directory
-k Skip cleanup
-h Show this help message
+-m [directory] Create a music CD using the given directory
EOF
}
data_dir=""
skip_cleanup=0
-while getopts "d:kh" flag; do
+music_dir=""
+while getopts "d:khm:" flag; do
case $flag in
d) data_dir="${OPTARG}";;
k) skip_cleanup=1;;
h) usage; exit 0;;
+ m) music_dir="${OPTARG}";;
*) usage; exit 1;;
esac
done
[[ $# -ne 0 ]] || die "unknown arguments at end. -h for help."
if [[ $data_dir != "" ]]; then
+ [[ $music_dir != "" ]] && die "You must specify only one of -d and -m"
temp_dir="`mktemp -d`"
echo "== created temporary directory $temp_dir"
if [[ $skip_cleanup == 1 ]]; then
trap remove_iso_temp EXIT
fi
echo "== creating ${temp_dir}/iso"
- hdiutil makehybrid -iso -joliet -o "${temp_dir}/temp" "${data_dir}"
+ hdiutil makehybrid -iso -joliet -o "${temp_dir}/temp" "${data_dir}" || die "iso creation failed"
echo "== burning ${temp_dir}/temp.iso"
hdiutil burn "${temp_dir}/temp.iso"
else
- die "You must supply a path. -h for help."
+ [[ $music_dir == "" ]] && die "You must specify one of -d and -m"
+ echo "== burning music cd..."
+ drutil burn -audio "${music_dir}"
fi