]> git.wh0rd.org - home.git/commitdiff
handle blank dvd labels
authorMike Frysinger <vapier@gentoo.org>
Sun, 21 Nov 2010 23:30:48 +0000 (18:30 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sat, 28 Apr 2012 19:36:37 +0000 (15:36 -0400)
.bin/backup-dvd

index 26f35a1685e18f86a36993ba5ab157519e606c14..5ea4286f760cb21ca111f8c6bcbabbb4df733bf7 100755 (executable)
@@ -7,19 +7,22 @@ usage() {
        Options:
         -i <input dev>      Defaults to ${dev}
         -o <output dir>     Defaults to ${out}
+        -n <volume name>    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}" \