Skip to content

Instantly share code, notes, and snippets.

@Cheatha

Cheatha/ripdisc.sh

Last active Apr 3, 2021
Embed
What would you like to do?
#!/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