Created
December 27, 2022 17:32
-
-
Save macowie/dfb31c9e5bf650dbd01e3d34d4a30b1a to your computer and use it in GitHub Desktop.
Copy disc to ISO
This file contains 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/sh | |
set -e | |
# Copy disc to ISO script. I believe everyone has to write one of these at some point | |
input=${1:-/dev/sr0} | |
info=$(isoinfo -d -i $input) | |
volume_id=$(echo "$info" | awk '/Volume id/' | awk '{print $NF}') | |
sector_size=$(echo "$info" | awk '/block size/' | awk '{print $NF}') | |
sector_count=$(echo "$info" | awk '/Volume size/' | awk '{print $NF}') | |
output=${2:-$volume_id.iso} | |
output=${output:-discimage.iso} | |
echo -e "Backing up $input to $output...\n" | |
dd if=$input of=$output bs=$sector_size count=$sector_count status=progress |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment