]>
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 # Set this to 4300 for DVD and 650 or 700 for CD
13 #DISK_CAPACITY=10 # testing
17 BSIZE
="$(echo "$DISK_CAPACITY*1024" | bc -l )"
18 TSIZE
="$(echo "$DISK_CAPACITY*1024*1024" | bc -l )"
20 # This is used for testing
21 #RECORD_BIN="dd of=/dev/null bs=1k if="
23 # This is for writing to CD with cdrtools, this uses track-at-once mode
24 # in case cdrtools does not support disk-at-once with your burner
25 #RECORD_BIN="/usr/bin/cdrecord dev=0,0,0 fs=64M speed=2 -eject -tao -pad -tsize=$TSIZE -data "
27 # This is for writing to DVD with cdrtools with DVD support, this has to
28 # use disk-at-once mode.
29 #RECORD_BIN="/usr/bin/cdrecord dev=0,0,0 fs=64M speed=2 -eject -dao -pad -tsize=$TSIZE -data "
31 # This is for writing to DVD with growisofs
32 RECORD_BIN
="/usr/bin/growisofs -Z /dev/dvd="
34 FIFO
="/tmp/dump.$$.fifo"
43 echo >&2 "Error $retcode: exiting"
50 # supplied info from "dump -F":
52 # $2 = sequence number
53 echo "Please insert disk No. $(($2+1))"
55 while [ "$ANSWER" != "y" ] ; do
56 echo -n "Is the disk ready? (y/n) "
58 if [ "$ANSWER" == "y" ] ; then
61 elif [ "$ANSWER" == "n" ] ; then
63 echo -n "Do you really want to exit? (y/n) "
65 if [ "$EXIT" == "y" ] ; then
72 if [ "$#" = "0" ] ||
[ "$1" = "-h" ] ||
[ "$1" = "--help" ]; then
73 echo >&2 "Usage: $0 <dump options>"
74 echo >&2 "See 'man dump' for dump options"
75 echo >&2 "the dump options -F -f -B are not required and are overridden"
79 set -m # We need proper job control
81 if [ "$#" = "2" ] && [ -p "$1" ]; then
82 write_output
"$@" ||
(kill $$
>/dev
/null
2>&1; exit 1)
87 if write_output
"$FIFO" "0"; then
88 if $DUMP "$@" -F "$0" -f "$FIFO" -B$BSIZE; then
89 echo "Waiting for background writing process to complete"
90 wait % # Wait for the background writing process
92 kill % >/dev
/null
2>&1 # or kill it
97 kill % >/dev
/null
2>&1 # Kill the background writing process