-n <volume name> Defaults to volume on disk
Commands:
+ --errors Image the raw disc first w/ddrescue
--backup Back up the disc
--modify Tweak runtime settings (needs -n)
--mkiso Create an iso (needs -n)
vol=
unset doit_{backup,modify,mkiso}
+doit_errors=false
-eval set -- `getopt -l backup,modify,mkiso -- hi:n:o: "$@"`
+eval set -- `getopt -l errors,backup,modify,mkiso -- hi:n:o: "$@"`
while [[ -n $1 ]] ; do
case $1 in
-h) usage;;
-o) out=$2; shift 2;;
-n) vol=$2; shift 2;;
+ --errors) doit_errors=true; shift;;
--backup) doit_backup=true; shift;;
--modify) doit_modify=true; shift;;
--mkiso) doit_mkiso=true; shift;;
"$@"
}
+#
+# Mirror the disc w/ddrescue which tolerates errors.
+#
+raw_read_dvd() {
+ echo "Imaging disc"
+ local raw=".${Volume}.raw"
+ local log="${raw}.log"
+ local opts=(
+ -v -b 2048 ${dev} "${raw}" "${log}"
+ )
+ ddrescue -p -n "${opts[@]}"
+ ddrescue -d -r 3 "${opts[@]}"
+ ddrescue -d -r 3 -R "${opts[@]}"
+ dev=${raw}
+}
+
#
# Backup the disc.
#
-opts=(
- -i ${dev}
- -o "${out}"
- -n "${Volume}"
-)
backup_dvd() {
echo "Backing up: ${Volume}"
+ local opts=(
+ -i ${dev}
+ -o "${out}"
+ -n "${Volume}"
+ )
if ! e dvdbackup -M "${opts[@]}" ; then
e dvdbackup -F "${opts[@]}" || exit 1
fi
local out_vts_dir="${out}/${Volume}/VIDEO_TS"
local vmgi vtsi
+ if ${doit_errors} ; then
+ echo "skipping modifications due to possible errors in files"
+ return
+ fi
+
for vmgi in "${out_vts_dir}"/VIDEO_TS.{IFO,BUP} ; do
process_vmgi "${vmgi}"
check_changes "${vmgi}" || exit 1
"${sh}" || exit
du -h "${out}/${Volume}.iso"
+ sudo chattr +i "${out}/${Volume}.iso"
}
+${doit_errors} && raw_read_dvd
${doit_backup} && backup_dvd
${doit_modify} && modify_dvd
${doit_mkiso} && mkiso_dvd