2013-11-14 18:11:48 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2014-11-12 16:15:39 +01:00
|
|
|
_usage () {
|
|
|
|
cat<<EOF
|
2014-07-02 09:37:48 +02:00
|
|
|
Usage: ${1##*/} [OPTIONS] ISOFILE
|
2013-11-14 18:11:48 +01:00
|
|
|
|
|
|
|
Dump optical disc to ISOFILE (without extension).
|
|
|
|
|
2014-01-06 11:24:43 +01:00
|
|
|
Options:
|
2013-11-14 18:11:48 +01:00
|
|
|
|
|
|
|
-h: Show this help.
|
|
|
|
-d DRIVE: Set optical drive to use (e.g. 'sr1').
|
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
DRIVE=/dev/sr0
|
|
|
|
while getopts ":hd:" opt; do
|
2014-11-12 16:15:39 +01:00
|
|
|
case $opt in
|
|
|
|
h)
|
|
|
|
_usage "$0"
|
|
|
|
exit 1 ;;
|
|
|
|
d)
|
|
|
|
DRIVE=/dev/$OPTARG ;;
|
|
|
|
\?)
|
|
|
|
_usage "$0"
|
|
|
|
exit 1 ;;
|
|
|
|
esac
|
2013-11-14 18:11:48 +01:00
|
|
|
done
|
|
|
|
|
2016-06-23 23:18:36 +02:00
|
|
|
shift $((OPTIND - 1))
|
2013-11-14 18:11:48 +01:00
|
|
|
|
|
|
|
if [ $# -eq 0 ]; then
|
2014-11-12 16:15:39 +01:00
|
|
|
_usage "$0"
|
|
|
|
exit 1
|
2013-11-14 18:11:48 +01:00
|
|
|
fi
|
|
|
|
|
2014-01-03 19:13:07 +01:00
|
|
|
if ! command -v readcd >/dev/null 2>&1; then
|
2014-11-12 16:15:39 +01:00
|
|
|
echo >&2 "'readcd' not found in PATH. Exiting."
|
|
|
|
exit 1
|
2013-11-14 18:11:48 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
## Fast?
|
2016-06-23 23:18:36 +02:00
|
|
|
readcd dev="$DRIVE" f="$1.iso" -v retries=5 timeout=30 -noerror
|
2013-11-14 18:11:48 +01:00
|
|
|
|
|
|
|
## 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
|