Package: backupninja
Version: 0.5-3
Severity: wishlist
Tags: patch

Attached is a handler for backing up to cd/dvd, and an example config file.

use of this handler would require packages:
mkisofs
cdrecord
dvd+rw-tools


-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.6.10-no-grsec
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages backupninja depends on:
ii  mawk                          1.3.3-11   a pattern scanning and text proces

-- no debconf information
#
# burncd handler script for backupninja
#
getconf backupdir /var/backups/makecd
getconf exclude
getconf target
getconf burnertype cd
getconf system no
getconf isoonly yes
getconf imagefile backup.iso
getconf device

# define needed executables:
MKISOFS="/usr/bin/mkisofs"
GROWISOFS="/usr/bin/growisofs"
#CDRECORD="/usr/bin/cdrecord"
CDRECORD="/usr/bin/cdrecord.mmap"
CDRDAO="/usr/bin/cdrdao"
DVDINFO="/usr/bin/dvd+rw-mediainfo"

# create backup dirs and check existence of progs.

[ -d $backupdir ] || mkdir -p $backupdir
[ -d $backupdir ] || fatal "Backup directory '$backupdir'"
[ -e "$target" ]  || fatal "target does not exist "

[ -x "$MKISOFS" ]   || debug 3 "echo executable mkisofs not present"
[ -x "$GROWISOFS" ] || debug 3 "echo executable growisofs not present"
[ -x "$CDRECORD" ]  || debug 3 "echo executable cdrecord not present"
[ -x "$CDRDAO" ]    || debug 3 "echo executable cdrdao not present"

if [ "$isoonly" == "no" ]; then
        [ -e $device ] || fatal "No Burner device available"
fi

outputfile="$backupdir/$imagefile"
execstr="$MKISOFS --quiet -R -o $outputfile "

str=""
# excludes
for i in $exclude; do
        str=" -x ${i}$str"
done

debug 0 "echo $str "
execstr="${execstr} $str $target "
debug 0 "echo $execstr "

output=` $execstr 2>&1 `
code=$?
if [ "$code" == "0" ]; then
        debug $output
        info "Successfully finished creation of iso"
else
        warning $output
        warning "Failed to create iso"
fi

if [ "$isoonly" == "no" ]; then

        if [ "$burnertype" == "cd" ]; then 
                # burning iso to CD
                $CDRECORD -v gracetime=2 dev=$device speed=8 -dao -data 
$outputfile 
                code=$?
                if [ "$code" == "0" ]; then
                        debug $output
                        info "Successfully burned CD"
                else
                        warning $output
                        warning "Failed to create CD"
                fi
        fi
        if [ "$burnertype" == "dvd" ]; then 
                # burning iso dvd
                $GROWISOFS -speed=2 -Z $device=$outputfile 
-use-the-force-luke=notray -use-the-force-luke=tty
                code=$?
                if [ "$code" == "0" ]; then
                        debug $output
                        info "Successfully burned DVD"
                else
                        warning $output
                        warning "Failed to create DVD"
                fi
        fi
fi
return 0
# TYP is cd or dvd AS WELL AS the disk inside!!
burnertype = cd

# system (yes) or directory/files (no)
# this function not yet implemented
#system = yes

# location for image file
backupdir = /var/backups/makecd

# image filename
imagefile = example.iso

# iso or burn to cd/dvd?
isoonly = no

# cd/dvd burner device
device=/dev/hdc

# base directory to include in the backup
target = /

# files or directories to be excluded
exclude = /proc
exclude = /lost+found
exclude = /tmp

# backupninja will perfrom this at gvien date/time
when = wednesday at 02:00

Reply via email to