The dirty double for multi volume afio

afio is able to create multi volume archives (see man 1 afio , option -s)
but this ability relies on two conditions which are not true with CD-Rs:
- afio wants to reopen a file when the next volume is to be created
  but there is a pipe to cdrecord (which may break) and no file (which
  may return EOF).
- Data that have not been written by afio can be read from CDs (like from
  Floppies) before EOF occurs. Despite afio usually can get back on track,
  the file which was divided by the piece border becomes corrupted.

Needed is a program that cuts the output of afio into suitable pieces and
starts cdrecord newly for each piece. For reading the backup there has to
be a program which trims the ends of the pieces, concatenates them, and
feeds them into afio.

Both tasks can be performed with  raedchen . It is very important that the
piece size is the same while reading as it was while writing.

Write CDs:
On-The_Fly:
  speed=2
  scsi_adr=3,0
  max_size=640m
  cdrecord_prog='/home/test/scdbackup-0.5.3/cdrecord_prog -v'
  find | afio -o - | raedchen -quiet -pipe - $max_size \
                     "$cdrecord_prog speed=$speed dev=$scsi_adr fs=8m -eject -"
                     -prompt "Insert next CD and press ENTER" \

With buffer file and compressed:
  speed=2
  scsi_adr=3,0
  max_size=640m
  cdrecord_prog='/home/test/scdbackup-0.5.3/cdrecord_prog -v'
  buffer=/cdpuffer/isofs
  find | afio -oZ - | raedchen -step 256k -post_text "compressed bytes" \
   -pipe - $max_size "cat >$buffer" -prompt "Insert next CD and press ENTER" \
   -post_pipe_command "$cdrecord_prog speed=$speed dev=$scsi_adr fs=8m -eject $buffer"


Read CDs:
  max_size=640m
  raedchen -quiet -pipe /dev/cdrom $max_size "cat" | afio -tv -



----------------------------------------------------------------------------

$ raedchen -help

usage : raedchen
           -count | -no_count | -cursor_home | -cursor_end |
           -output | -no_output | -step number |
           -print_count | -print_count_stdout |
           -print_count_off | -post_text text |
           -pipe source size command | -prompt text |
            -post_pipe_command command | -quiet | -loud

This program entertains the user while copying
standard input to standard output. It usually shows a
spinning bar and the byte count.
-quiet prevents the output of entertaining messages.
-loud (which is the default) enables this output.
-no_count prevents showing the byte count.
-no_output is equal to >/dev/null but 30 % faster.
-step adjusts the count interval.
(Default is -step 64k, try -step 100000 or -step 1m )
Usually after exit no visible text is left
(-print_count_off) but
-print_count prints the final count on standard error
-print_count_stdout prints this on standard output
-post_text defines the text to be shown after the
bytecount. (default is -post_text 'bytes' )

A second purpose of this program is to cut the data
stream into pieces and to feed them into the
standard input of a shell command. This command is
executed at the start of each piece and should end
properly on EOF at standard input.
Between the pieces, the user is prompted to prepare
the next one (e.g. insert next CD)
-pipe divides the output into pieces of at most
'number' size. Each piece is piped into the standard
input of a newly started instance of 'command'.
If 'source' is '-' the standard input is read. Any
other text is used as name of a file which is opened
at the start of each piece and closed after its end.
This is suitable for device files. Data files should
be read by piping them into standard input.
-prompt defines the text to be asked between the
pieces. default: 'Prepare next piece and press ENTER'
-post_pipe_command defines a shell command which is
executed when a -pipe piece is closed and the -pipe
command has ended.

----------------------------------------------------------------------------

Write to floppies:
find | afio -ov - | raedchen -quiet -pipe - 1400k 'cat >/dev/fd0'

Read floppies:
raedchen -quiet -pipe /dev/fd0 1400k 'cat' | afio -tv -