1 # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
2 # vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
4 # burncd handler script for backupninja
6 getconf backupdir /var/backups/makecd
12 getconf imagefile backup.iso
16 # define needed executables:
17 MKISOFS="/usr/bin/genisoimage"
18 GROWISOFS="/usr/bin/growisofs"
19 CDRECORD="/usr/bin/wodim"
20 CDRDAO="/usr/bin/cdrdao"
21 DVDINFO="/usr/bin/dvd+rw-mediainfo"
23 # create backup dirs and check existence of progs.
25 [ -d $backupdir ] || mkdir -p $backupdir
26 [ -d $backupdir ] || fatal "Backup directory '$backupdir'"
27 [ -e "$target" ] || fatal "target does not exist "
29 [ -x "$MKISOFS" ] || debug 3 "echo executable $MKISOFS not present"
30 [ -x "$GROWISOFS" ] || debug 3 "echo executable $GROWISOFS not present"
31 [ -x "$CDRECORD" ] || debug 3 "echo executable $CDRECORD not present"
32 [ -x "$CDRDAO" ] || debug 3 "echo executable $CDRDAO not present"
34 if [ "$isoonly" == "no" ]; then
35 [ -e $device ] || fatal "No Burner device available"
38 outputfile="$backupdir/$imagefile"
39 execstr="nice -n $nicelevel $MKISOFS --quiet -R -o $outputfile "
48 execstr="${execstr} $str $target "
49 debug 0 "echo $execstr "
51 output=` $execstr 2>&1 `
53 if [ "$code" == "0" ]; then
55 info "Successfully finished creation of iso"
58 warning "Failed to create iso"
61 if [ "$isoonly" == "no" ]; then
63 if [ "$burnertype" == "cd" ]; then
65 $CDRECORD -v gracetime=2 dev=$device speed=8 -dao -data $outputfile
67 if [ "$code" == "0" ]; then
69 info "Successfully burned CD"
72 warning "Failed to create CD"
75 if [ "$burnertype" == "dvd" ]; then
77 $GROWISOFS -speed=2 -Z $device=$outputfile -use-the-force-luke=notray -use-the-force-luke=tty
79 if [ "$code" == "0" ]; then
81 info "Successfully burned DVD"
84 warning "Failed to create DVD"