Skip to content

Instantly share code, notes, and snippets.

@scaramangado
Created August 8, 2024 06:20
Show Gist options
  • Select an option

  • Save scaramangado/7e21e2d5c77705602bd1e27e241e6b82 to your computer and use it in GitHub Desktop.

Select an option

Save scaramangado/7e21e2d5c77705602bd1e27e241e6b82 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
[[ $# != 2 ]] && exit -1
dvd_drive=$1
destination=$2
info=$(isoinfo -d -i /dev/sr0)
block_size=$(grep -oP '(?<=Logical block size is: )\d+' <<< "$info")
volume_size=$(grep -oP '(?<=Volume size is: )\d+' <<< "$info")
total_bytes=$((block_size * volume_size))
echo "Block size: $block_size"
echo "Volume size: $volume_size"
echo "Total bytes: $total_bytes"
echo "Ripping..."
dd if="$1" bs="$block_size" count="$volume_size" | pv -s "$total_bytes" | dd of="$2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment