aboutsummaryrefslogtreecommitdiff
path: root/handlers/makecd.in
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2007-10-12 17:06:09 +0000
committerintrigeri <intrigeri@boum.org>2007-10-12 17:06:09 +0000
commit579ea902ba24854b3c9acb307cda7e996e8e41a3 (patch)
tree373ce0a2242050dad65b84950520c6d44a9445fc /handlers/makecd.in
parentbe75e4e6c536882c14db9a41c61585e7a9c045f6 (diff)
downloadbackupninja-579ea902ba24854b3c9acb307cda7e996e8e41a3.tar.gz
backupninja-579ea902ba24854b3c9acb307cda7e996e8e41a3.tar.bz2
fixed autotools build, broken since r466, inhandlers/Makefile.am
Diffstat (limited to 'handlers/makecd.in')
-rw-r--r--handlers/makecd.in88
1 files changed, 88 insertions, 0 deletions
diff --git a/handlers/makecd.in b/handlers/makecd.in
new file mode 100644
index 0000000..cdfa6b1
--- /dev/null
+++ b/handlers/makecd.in
@@ -0,0 +1,88 @@
+# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
+#
+# 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
+getconf nicelevel 0
+
+# 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="nice -n $nicelevel $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