11 *)die "This script only works on MacOS"
16 nero.sh: CD-R burning tool for MacOS.
18 -d [directory] Create a data CD using the given directory
20 -h Show this help message
21 -m [directory] Create a music CD using the given directory
28 while getopts "d:khm:" flag; do
30 d) data_dir="${OPTARG}";;
33 m) music_dir="${OPTARG}";;
38 [[ $# -ne 0 ]] || die "unknown arguments at end. -h for help."
40 if [[ $data_dir != "" ]]; then
41 [[ $music_dir != "" ]] && die "You must specify only one of -d and -m"
42 temp_dir="`mktemp -d`"
43 echo "== created temporary directory $temp_dir"
44 if [[ $skip_cleanup == 1 ]]; then
45 echo "== will not install cleanup hook"
47 function remove_iso_temp {
48 echo "== removing $temp_dir"
49 rm -rf -- "${temp_dir}"
51 trap remove_iso_temp EXIT
53 echo "== creating ${temp_dir}/iso"
54 hdiutil makehybrid -iso -joliet -o "${temp_dir}/temp" "${data_dir}" || die "iso creation failed"
55 echo "== burning ${temp_dir}/temp.iso"
56 hdiutil burn "${temp_dir}/temp.iso"
58 [[ $music_dir == "" ]] && die "You must specify one of -d and -m"
59 echo "== burning music cd..."
60 drutil burn -audio "${music_dir}"