Skip to content

Instantly share code, notes, and snippets.

@Cheatha
Last active June 7, 2021 21:05
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cheatha/05f7a844e58fe037c50d6688d4b6377b to your computer and use it in GitHub Desktop.
Save Cheatha/05f7a844e58fe037c50d6688d4b6377b to your computer and use it in GitHub Desktop.
#!/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