# HG changeset patch # User Robert McIntyre # Date 1361799046 0 # Node ID e736b9aaf5ad35286a58d1bfc9ca48e5af513ea5 # Parent 11334e7aed98b12b0605d2f2d5ba8f587f5ffbc0 various attempts to do multisession burning; giving up for now. diff -r 11334e7aed98 -r e736b9aaf5ad cd-backup-parse.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cd-backup-parse.pl Mon Feb 25 13:30:46 2013 +0000 @@ -0,0 +1,89 @@ +#!/bin/perl + +$tmp_iso="/home/r/tmp/image.iso"; + + +use File::Basename; + +$session_info = `cdrecord -minfo 2>/dev/null`; +$multi_sessionP = false; + + +# get the last 2 lines from $session_info, and use them to construct +# the proper flags for mkisofs. + +@session_info_lines = split("\n", $session_info); + +$session_number_line = $session_info_lines[-2]; +$start_address_line = $session_info_lines[-1]; + +if ($session_number_line =~ m/^Last session start address:\s*(\d+)/){ + $session_number = $1; + if ($start_address_line =~ m/^Last session leadout start address:\s*(\d+)/){ + $start_address = $1; + $multi_sessionP = true; + } +} + +#print "$multi_sessionP\n$session_number\n$start_address\n"; + +@graft_points = ("-graft-points"); + +for $graft_point(@ARGV){ + push(@graft_points, basename($graft_point) . "=" . $graft_point); +} + +@create_iso_command = ("mkisofs", "-iso-level", "4", "-r", "-J", "-T"); + + +if ($multi_sessionP){ + $C_spec = "$session_number,$start_address"; + @additional_args = ("-M", "/dev/cdrom", "-C", $C_spec); + @create_iso_command = (@create_iso_command, @additional_args); +} + +@create_iso_command = (@create_iso_command, "-o", $tmp_iso, @graft_points); + + +@remove_previous_iso_command = ("rm", "-f", $tmp_iso); +print "@remove_previous_iso_command\n"; +system(@remove_previous_iso_command); + +print "@create_iso_command\n"; +system(@create_iso_command); + +print "Created $tmp_iso.\n"; +print "Use burn-tmp-iso-image to write to CD.\n"; +if ($multi_sessionP){ + print "Note: this will be a multisession disk!.\n" +} + +# #START=`cdrecord -msinfo` + +# #echo "$START" + +# GRAFT_POINTS='' + +# for var in "$@" +# do +# GRAFT_POINTS="$GRAFT_POINTS \"`basename "$var"`\"=\"$var\"" +# done + + +# #echo $GRAFT_POINTS + +# #if [ "$START" == "0,0" ]; then +# COMMAND="mkisofs -iso-level 4 -rJT -o $TARGET -graft-points $GRAFT_POINTS" +# # echo $COMMAND +# # eval $COMMAND +# #else +# # COMMAND="mkisofs -iso-level 4 -rJT -M /dev/cdrom \ +# # -C $START -o $TARGET -graft-points $GRAFT_POINTS" +# echo $COMMAND +# eval $COMMAND +# #fi + + +# echo "files copied to $TARGET. use 'burn-tmp-iso-image' to burn it." + +# #cd-burn diff -r 11334e7aed98 -r e736b9aaf5ad cd-backup.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cd-backup.pl Mon Feb 25 13:30:46 2013 +0000 @@ -0,0 +1,90 @@ +#!/bin/perl + +$tmp_iso="/home/r/tmp/image.iso"; + + +use File::Basename; + +$session_info = `cdrecord -minfo 2>/dev/null`; +$multi_sessionP = false; + + +# get the last 2 lines from $session_info, and use them to construct +# the proper flags for mkisofs. + +@session_info_lines = split("\n", $session_info); + +$session_number_line = $session_info_lines[-2]; +$start_address_line = $session_info_lines[-1]; + +if ($session_number_line =~ m/^Last session start address:\s*(\d+)/){ + $session_number = $1; + if ($start_address_line =~ m/^Last session leadout start address:\s*(\d+)/){ + $start_address = $1; + $multi_sessionP = true; + } +} + +#print "$multi_sessionP\n$session_number\n$start_address\n"; + +@graft_points = ("-graft-points"); + +for $graft_point(@ARGV){ + push(@graft_points, basename($graft_point) . "=" . $graft_point); +} + +@create_iso_command = ("mkisofs", "-iso-level", "4", "-r", "-J", "-T"); + + +if ($multi_sessionP){ +# $C_spec = "$session_number,$start_address"; + $C_spec = "1,$start_address"; + @additional_args = ("-M", "/dev/cdrom", "-C", $C_spec); + @create_iso_command = (@create_iso_command, @additional_args); +} + +@create_iso_command = (@create_iso_command, "-o", $tmp_iso, @graft_points); + + +@remove_previous_iso_command = ("rm", "-f", $tmp_iso); +print "@remove_previous_iso_command\n"; +system(@remove_previous_iso_command); + +print "@create_iso_command\n"; +system(@create_iso_command); + +print "Created $tmp_iso.\n"; +print "Use burn-tmp-iso-image to write to CD.\n"; +if ($multi_sessionP){ + print "Note: this will be a multisession disk!.\n" +} + +# #START=`cdrecord -msinfo` + +# #echo "$START" + +# GRAFT_POINTS='' + +# for var in "$@" +# do +# GRAFT_POINTS="$GRAFT_POINTS \"`basename "$var"`\"=\"$var\"" +# done + + +# #echo $GRAFT_POINTS + +# #if [ "$START" == "0,0" ]; then +# COMMAND="mkisofs -iso-level 4 -rJT -o $TARGET -graft-points $GRAFT_POINTS" +# # echo $COMMAND +# # eval $COMMAND +# #else +# # COMMAND="mkisofs -iso-level 4 -rJT -M /dev/cdrom \ +# # -C $START -o $TARGET -graft-points $GRAFT_POINTS" +# echo $COMMAND +# eval $COMMAND +# #fi + + +# echo "files copied to $TARGET. use 'burn-tmp-iso-image' to burn it." + +# #cd-burn diff -r 11334e7aed98 -r e736b9aaf5ad cd-backup.sh --- a/cd-backup.sh Mon Feb 25 09:35:08 2013 +0000 +++ b/cd-backup.sh Mon Feb 25 13:30:46 2013 +0000 @@ -24,7 +24,7 @@ # COMMAND="mkisofs -iso-level 4 -rJT -M /dev/cdrom \ # -C $START -o $TARGET -graft-points $GRAFT_POINTS" echo $COMMAND - eval $COMMAND +# eval $COMMAND #fi diff -r 11334e7aed98 -r e736b9aaf5ad simple-cd-backup.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/simple-cd-backup.pl Mon Feb 25 13:30:46 2013 +0000 @@ -0,0 +1,26 @@ +#!/bin/perl +use File::Basename; + +$tmp_iso="/home/r/tmp/image.iso"; + +@graft_points = ("-graft-points"); + +for $graft_point(@ARGV){ + push(@graft_points, basename($graft_point) . "=" . $graft_point); +} + +@create_iso_command = ("mkisofs", "-iso-level", "4", "-r", "-J", "-T"); + +@create_iso_command = (@create_iso_command, "-o", $tmp_iso, @graft_points); + + +@remove_previous_iso_command = ("rm", "-f", $tmp_iso); +print "@remove_previous_iso_command\n"; +system(@remove_previous_iso_command); + +print "@create_iso_command\n"; +system(@create_iso_command); + +print "Created $tmp_iso.\n"; +print "Use burn-tmp-iso-image to write to CD.\n"; +