1 # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
3 # burncd handler script for backupninja
5 getconf backupdir /var/backups/makecd
11 getconf imagefile backup.iso
15 # define needed executables:
16 MKISOFS="/usr/bin/genisoimage"
17 GROWISOFS="/usr/bin/growisofs"
18 CDRECORD="/usr/bin/wodim"
19 CDRDAO="/usr/bin/cdrdao"
20 DVDINFO="/usr/bin/dvd+rw-mediainfo"
22 # create backup dirs and check existence of progs.
24 [ -d $backupdir ] || mkdir -p $backupdir
25 [ -d $backupdir ] || fatal "Backup directory '$backupdir'"
26 [ -e "$target" ] || fatal "target does not exist "
28 [ -x "$MKISOFS" ] || debug 3 "echo executable $MKISOFS not present"
29 [ -x "$GROWISOFS" ] || debug 3 "echo executable $GROWISOFS not present"
30 [ -x "$CDRECORD" ] || debug 3 "echo executable $CDRECORD not present"
31 [ -x "$CDRDAO" ] || debug 3 "echo executable $CDRDAO not present"
33 if [ "$isoonly" == "no" ]; then
34 [ -e $device ] || fatal "No Burner device available"
37 outputfile="$backupdir/$imagefile"
38 execstr="nice -n $nicelevel $MKISOFS --quiet -R -o $outputfile "
47 execstr="${execstr} $str $target "
48 debug 0 "echo $execstr "
50 output=` $execstr 2>&1 `
52 if [ "$code" == "0" ]; then
54 info "Successfully finished creation of iso"
57 warning "Failed to create iso"
60 if [ "$isoonly" == "no" ]; then
62 if [ "$burnertype" == "cd" ]; then
64 $CDRECORD -v gracetime=2 dev=$device speed=8 -dao -data $outputfile
66 if [ "$code" == "0" ]; then
68 info "Successfully burned CD"
71 warning "Failed to create CD"
74 if [ "$burnertype" == "dvd" ]; then
76 $GROWISOFS -speed=2 -Z $device=$outputfile -use-the-force-luke=notray -use-the-force-luke=tty
78 if [ "$code" == "0" ]; then
80 info "Successfully burned DVD"
83 warning "Failed to create DVD"