Skip to content

Commit

Permalink
Add DVD backup script
Browse files Browse the repository at this point in the history
  • Loading branch information
AgenttiX committed Jan 12, 2024
1 parent 47bf8e4 commit 0cf8f23
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ zsh-syntax-highlighting
*.idx
*.iso
*.jar
*.log
*.mec
*.mcd
*.mcr
*.nvm
*.ps2
*.sha256
*.tar
*.tar.gz
*.tgz
Expand Down
28 changes: 28 additions & 0 deletions backup/backup_dvd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -e

if [ "${EUID}" -eq 0 ]; then
echo "This script should not be run as root."
exit 1
fi

if [ $# -eq 1 ]; then
DEVICE="/dev/sr0"
elif [ $# -eq 2 ]; then
DEVICE=$1
else
echo "Invalid number of arguments."
exit 1
fi
FILENAME=$1

if [ $(command -v ddrescue &> /dev/null) -or $(command -v 7zr &> /dev/null) ]; then :; else
echo "The necessary packages appear not to be installed. Installing."
sudo apt-get update
sudo apt-get install gddrescue p7zip
fi

ddrescue -b 2048 -n -v "${DEVICE}" "${FILENAME}.iso" rescue.log
mv rescue.log "${FILENAME}-rescue.log"
sha256sum "${FILENAME}.iso" > "${FILENAME}.iso.sha256"
7zr a -mx=9 "${FILENAME}.7z" "${FILENAME}.iso" "${FILENAME}.iso.sha256"

0 comments on commit 0cf8f23

Please sign in to comment.