Created
August 21, 2019 10:28
-
-
Save mpapierski/5dc675ecd7d55483cdf6e082860c51bc to your computer and use it in GitHub Desktop.
Semi-automatic DVD backup tool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
DEV="/dev/dvd" | |
ISO_OUTPUT="/mnt/vault/Movies/DVD Backup/" | |
echo -n "Trying to read DVD label... " | |
DVD_NAME="$(blkid -o value -s LABEL $DEV)" | |
if [ x"$DVD_NAME" = 'x' ]; then | |
echo "Found empty DVD label." | |
echo -n "Please enter intended label: " | |
read DVD_NAME | |
fi | |
if [ -f "${ISO_OUTPUT}/${DVD_NAME}.iso" ]; then | |
echo "Warning: ${ISO_OUTPUT}/${DVD_NAME}.iso file exists." | |
echo -n "Please enter new disk label: " | |
read DVD_NAME | |
fi | |
echo "Disk label: ${DVD_NAME}" | |
# RIP first | |
dvdbackup -i $DEV --name "$DVD_NAME" -o "." -M | |
# DVD is done - can insert new disk | |
eject $DEV | |
echo -n "Rip directory size: " | |
RIP_SIZE="$(du -sh "$DVD_NAME" | cut -f1)" | |
echo "${RIP_SIZE}" | |
# Create ISO | |
mkisofs -dvd-video -udf -o "${ISO_OUTPUT}/${DVD_NAME}.iso" "${DVD_NAME}" | |
echo -n "Removing directory ${DVD_NAME}... " | |
rm -rf "${DVD_NAME}" | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment