From 2b2f7f171260b07454bbf077e2b9a07e2eb63ee0 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 21 Nov 2010 18:30:48 -0500 Subject: [PATCH] handle blank dvd labels --- .bin/backup-dvd | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/.bin/backup-dvd b/.bin/backup-dvd index 26f35a1..5ea4286 100755 --- a/.bin/backup-dvd +++ b/.bin/backup-dvd @@ -7,19 +7,22 @@ usage() { Options: -i Defaults to ${dev} -o Defaults to ${out} + -n Defaults to volume on disk EOF exit ${1:-0} } dev=/dev/cdrom out=${PWD} +vol= -eval set -- `getopt -- hi:o: "$@"` +eval set -- `getopt -- hi:n:o: "$@"` while [[ -n $1 ]] ; do case $1 in -h) usage;; -i) dev=$2; shift 2;; -o) out=$2; shift 2;; + -n) vol=$2; shift 2;; --) shift; break;; -*) usage 1;; *) usage 2; break;; @@ -31,18 +34,20 @@ Application= # -A Preparer= # -p Publisher= # -publisher System= # -sysid -Volume= # -V +Volume=${vol} # -V Volume_Set= # -volset -info=$(iso-info ${dev}) || exit 1 +if [[ -z ${Volume} ]] ; then + info=$(iso-info ${dev}) || exit 1 -eval $(echo "${info}" | awk -F: ' - (NF > 1 && $1 !~ /image/) { - sub(/ *$/, "", $1); - sub(/ /, "_", $1); - sub(/^ */, "", $2); - print $1 "=\"" $2 "\""; -}') + eval $(echo "${info}" | awk -F: ' + (NF > 1 && $1 !~ /image/) { + sub(/ *$/, "", $1); + sub(/ /, "_", $1); + sub(/^ */, "", $2); + print $1 "=\"" $2 "\""; + }') +fi if [[ -z ${Volume} ]] ; then echo "Unable to parse Volume out of ISO" @@ -59,7 +64,7 @@ e() { echo "$@" } -e dvdbackup -M -i ${dev} -o "${out}" +e dvdbackup -M -i ${dev} -o "${out}" -n "${Volume}" e mkisofs -quiet -dvd-video \ -A "${Application}" \ -p "${Preparer}" \ -- 2.39.5