3 # Bacula interface to growisofs, used to write to DVD+/-R(W)
7 # If you set in your Device resource
9 # Write Part Command = "path-to-this-script/dvd-writepart %n %a %v"
10 # you will have the following input to this script:
12 # dvd-writepart "erase" "device" "part_filename"
17 # dvd-writepart 0 /dev/hda File-0001
22 # GROWARGS="-use-the-force-luke=tty -quiet"
25 # Uncomment the following line if you do not want the tray to be reloaded
27 GROWARGS="${GROWARGS} -use-the-force-luke=notray"
29 #### You should probably not modify anything below this line
31 # If Linux kernel version >=2.6.8, allow a session to start beyond the
33 kver=`uname -r | cut -d. -f1,2`
34 ksubver=`uname -r | cut -d. -f3 | cut -d- -f1`
36 if test "a$kver" = "a2.6" ; then
37 if test "$ksubver" > 7 ; then
38 echo "Kernel version >= 2.6.8, allowing to cross the 4gb boundary."
39 GROWARGS="${GROWARGS} -use-the-force-luke=4gms"
43 if test $# -ne 3 ; then
44 echo "usage: dvd-writepart part_number device part_filename"
45 echo " Wrong number of arguments arguments given (!= 3)."
54 if test $erase = 1 ; then
61 echo Running ${GROWISOFS} ${GROWARGS} $arg $dev -R $filename...
62 ${GROWISOFS} ${GROWARGS} $arg $dev -R $filename &
63 #bash -c "while [ 1 ]; do echo "G"; sleep 1; done" &
67 # Starts watchdog : checks if the parent is alive. If not, kill
70 bash -c "rtn=0; while [ \$rtn = 0 ]; do sleep 5; ps -p $parentpid; rtn=\$?; echo W\$rtn; done; echo \"Parent dead killing $growpid\"; kill $growpid; sleep 5; kill -9 $growpid" &
73 # Waits for growisofs to stop