54 lines
950 B
Bash
Executable File
54 lines
950 B
Bash
Executable File
#!/bin/sh
|
|
|
|
_printhelp ()
|
|
{
|
|
cat<<EOF
|
|
Usage: ${1##*/} [OPTIONS] FILES
|
|
|
|
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)
|
|
_printhelp "$0"
|
|
exit 1 ;;
|
|
d)
|
|
DRIVE=/dev/$OPTARG ;;
|
|
?)
|
|
_printhelp "$0"
|
|
exit 1 ;;
|
|
:)
|
|
_printhelp "$0"
|
|
exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
if [ $# -eq 0 ]; then
|
|
_printhelp "$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
|