Last active
June 7, 2021 21:05
-
-
Save Cheatha/05f7a844e58fe037c50d6688d4b6377b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
cd_path="/dev/sr0" | |
out_path="/media/isos/iso" | |
mkdir -p $out_path | |
cd_id="$(date +%s | sha256sum | head -c 8 ; echo)" | |
cd_id="${cd_id^^}" | |
bs=$(isoinfo -d -i ${cd_path} | grep -i -E 'block size'|awk '{print $NF}' ) | |
if [[ -z $bs ]]; then | |
ddrescue -n -v $cd_path $out_path/$cd_id.iso $out_path/$cd_id.log | |
else | |
ddrescue -b $bs -n -v $cd_path $out_path/$cd_id.iso $out_path/$cd_id.log | |
fi | |
echo -e "\n=============\n" | |
echo "Disc-ID: $cd_id" | |
eject |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment