50 lines
785 B
Bash
Executable File
50 lines
785 B
Bash
Executable File
#!/bin/sh
|
|
|
|
_usage () {
|
|
cat<<EOF
|
|
Usage: ${1##*/} [OPTIONS] ISOFILE
|
|
|
|
Dump optical disc to ISOFILE (without extension).
|
|
|
|
Options:
|
|
|
|
-h: Show this help.
|
|
-d DRIVE: Set optical drive to use (e.g. 'sr1').
|
|
|
|
EOF
|
|
}
|
|
|
|
DRIVE=/dev/sr0
|
|
while getopts ":hd:" opt; do
|
|
case $opt in
|
|
h)
|
|
_usage "$0"
|
|
exit 1 ;;
|
|
d)
|
|
DRIVE=/dev/$OPTARG ;;
|
|
\?)
|
|
_usage "$0"
|
|
exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
shift $((OPTIND - 1))
|
|
|
|
if [ $# -eq 0 ]; then
|
|
_usage "$0"
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v readcd >/dev/null 2>&1; then
|
|
echo >&2 "'readcd' not found in PATH. Exiting."
|
|
exit 1
|
|
fi
|
|
|
|
## Fast?
|
|
readcd dev="$DRIVE" f="$1.iso" -v retries=5 timeout=30 -noerror
|
|
|
|
## Slow
|
|
# readcd f="$1.iso" -v retries=32 timeout=30 -s speed=16 -noerror
|
|
|
|
# dd if=$DRIVE of='$1.iso' bs=2048 count=$(isosize -d 2048 $DRIVE) conv=sync,notrunc
|