~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
previous Abstract Copyright Contents next
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Backups on CD
Chapter 3 Details
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

3.1 The Burning Process

I think the easiest way to learn about this is to have a look on the source.

If you don't understand how it works please don't email me. Learn more about sh, tar, baseutils and cdrecord.

Assume that tar is invoked as followed:

     mkfifo fifo
     tar -cpvz -X $excludelist --file=fifo * &


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

3.2 toast.sh $params fifo

     if test "$1"; then
     # > 0?
       source $1
     else
       exit 1
     fi
     
     mkdir $toast_dir
     let count=tracks
     
     for i in {0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}; do
       dd of=$archive.$i bs=1k count=$(expr $tracksize \* 1024)
         wait
       if ! test -s "$archive.$i" && ! test -e "$toast_dir/$arch_name.*"; then
         # file existists but has length of null bytes: finished
         rm $archive.$i
         $ejectcmd > /dev/null 2>&1
         break
       else
         if test $(expr $i % $count) -eq 0; then
           if test $(expr $i) -gt 0; then
             $ejectcmd > /dev/null 2>&1
             echo -e "\a\nPlease change the disk. Insert volume $(expr $i / $count + 1) and press any key to continue." > /dev/tty
             read ans < /dev/tty
           fi
           let count=tracks
           if test -e "$toast_dir/$arch_name.*"; then
           # Last CD 'lost' one Track
             let count-=1
           fi
           volid="-V $volume_name$(expr $i / $count + 1)"
           vol="-volset $(expr $i / $count + 1)"
           touch $toast_dir/"$volume_name$(expr $i / $count + 1)"
           blank="-blank=fast"
           multiinfo=""
         else
           volid=""
           vol=""
           blank=""
           let rec=1
           while test $rec -ne 0; do
             multiinfo="-C $(cdrecord $dev -msinfo) -M $rawdevice" 2>> $logfile
             rec=$?
           done
         fi
     
         mv $archive.$i $toast_dir
         if test $(expr $(ls -s $toast_dir/$arch_name.$i | awk '{ print $1 }') / 1024) -lt $tracksize; then
           touch $toast_dir/$end_mark
         fi
     
         mkimg="mkisofs -r -J"
         tsize="$($mkimg -q -print-size $toast_dir 2>&1 | tail -n 1 | awk '{print $NF}')"s
         ( nice -n -10 $mkimg -L $vol $volid $multiinfo $toast_dir | cdrecord -v $dev $devdepend $blank -multi tsize=$tsize - && rm $toast_dir/* ) 2>> $logfile &
       fi
     done


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
previous Abstract Copyright Contents next
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Backups on CD
17 April 2000
Holger Nassenstein backups@tuxoncd.de
ANY Browser Campaign: http://www.anybrowser.org/