]>
git.wh0rd.org - dump.git/blob - examples/dump_on_cd_3/dump_disk
3 # This script dumps the specified Filesystem via dump on a CD/DVD
4 # DISK_CAPACITY defines the capacity in MB per disk.
5 # The script's own name $0 is passed via the -F option of dump
6 # When using cdrecord/dvdrecord and at least for my DVD-Recorder (a PHILIPS
7 # DVR-A03) it is necessary to define the tracksize for the next track before
8 # the DVD is written. This is done via the -tsize option of cdrecord. Since
9 # tsize takes its arguments in Bytes, the shell cannot compute the value
10 # correctly anymore (value too high), so I use bc.
12 # If you use growisofs which does not have the 10 second delay before burning
13 # of cdrecord you may want to uncomment SLEEP="10" to ensure there is data
14 # waiting on the fifo before burning starts
16 FIFO
="/tmp/dump.$$.fifo"
17 #DISK_CAPACITY=10 # testing
19 BSIZE
="$(echo "$DISK_CAPACITY*1024" | bc -l )"
20 TSIZE
="$(echo "$DISK_CAPACITY*1024*1024" | bc -l )"
21 #RECORD_BIN="dd of=/dev/null bs=1k if=" # testing
22 #RECORD_BIN="/usr/bin/dvdrecord dev=0,0,0 fs=64M speed=2 -eject -dao -pad -tsize=$TSIZE -data "
23 RECORD_BIN
="/usr/bin/growisofs -Z /dev/dvd="
33 echo >&2 "Error $retcode: exiting"
40 # supplied info from "dump -F":
42 # $2 = sequence number
43 echo "Please insert disk No. $(($2+1))"
45 while [ "$ANSWER" != "y" ] ; do
46 echo -n "Is the disk ready? (y/n) "
48 if [ "$ANSWER" == "y" ] ; then
49 ([ -n "$SLEEP" ] && sleep $SLEEP; ${RECORD_BIN}${1}) &
51 elif [ "$ANSWER" == "n" ] ; then
53 echo -n "Do you really want to exit? (y/n) "
55 if [ "$EXIT" == "y" ] ; then
62 if [ "$#" = "0" ] ||
[ "$1" = "-h" ] ||
[ "$1" = "--help" ]; then
63 echo >&2 "Usage: $0 <dump options>"
64 echo >&2 "See 'man dump' for dump options"
65 echo >&2 "the dump options -F -f -B are not required and are overridden"
69 set -m # We need proper job control
71 if [ "$#" = "2" ] && [ -p "$1" ]; then
72 write_output
"$@" ||
(kill $$
>/dev
/null
2>&1; exit 1)
77 if write_output
"$FIFO" "0"; then
78 if $DUMP "$@" -F "$0" -f "$FIFO" -B$BSIZE; then
79 kill % >/dev
/null
2>&1 # Kill the background writing process
81 wait % # Or wait for it to complete