changeset 8:e736b9aaf5ad

various attempts to do multisession burning; giving up for now.
author Robert McIntyre <rlm@mit.edu>
date Mon, 25 Feb 2013 13:30:46 +0000
parents 11334e7aed98
children acd110f8e4b0
files cd-backup-parse.pl cd-backup.pl cd-backup.sh simple-cd-backup.pl
diffstat 4 files changed, 206 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/cd-backup-parse.pl	Mon Feb 25 13:30:46 2013 +0000
     1.3 @@ -0,0 +1,89 @@
     1.4 +#!/bin/perl
     1.5 +
     1.6 +$tmp_iso="/home/r/tmp/image.iso";
     1.7 +
     1.8 +
     1.9 +use File::Basename;
    1.10 +
    1.11 +$session_info = `cdrecord -minfo 2>/dev/null`;
    1.12 +$multi_sessionP = false;
    1.13 +
    1.14 +
    1.15 +# get the last 2 lines from $session_info, and use them to construct
    1.16 +# the proper flags for mkisofs.
    1.17 +
    1.18 +@session_info_lines = split("\n", $session_info);
    1.19 +
    1.20 +$session_number_line = $session_info_lines[-2];
    1.21 +$start_address_line  = $session_info_lines[-1];
    1.22 +
    1.23 +if ($session_number_line =~ m/^Last session start address:\s*(\d+)/){
    1.24 +    $session_number = $1;
    1.25 +    if ($start_address_line =~ m/^Last session leadout start address:\s*(\d+)/){
    1.26 +	$start_address = $1;
    1.27 +	$multi_sessionP = true;
    1.28 +    }
    1.29 +}
    1.30 +
    1.31 +#print "$multi_sessionP\n$session_number\n$start_address\n";
    1.32 +
    1.33 +@graft_points = ("-graft-points");
    1.34 +
    1.35 +for $graft_point(@ARGV){
    1.36 +    push(@graft_points, basename($graft_point) . "=" . $graft_point);
    1.37 +}
    1.38 +
    1.39 +@create_iso_command =  ("mkisofs", "-iso-level", "4", "-r", "-J", "-T");
    1.40 +
    1.41 +
    1.42 +if ($multi_sessionP){
    1.43 +    $C_spec = "$session_number,$start_address";
    1.44 +    @additional_args = ("-M", "/dev/cdrom", "-C", $C_spec);
    1.45 +    @create_iso_command = (@create_iso_command, @additional_args);
    1.46 +}
    1.47 +    
    1.48 +@create_iso_command = (@create_iso_command, "-o", $tmp_iso, @graft_points);
    1.49 +
    1.50 +
    1.51 +@remove_previous_iso_command = ("rm", "-f", $tmp_iso);
    1.52 +print "@remove_previous_iso_command\n";
    1.53 +system(@remove_previous_iso_command);
    1.54 +
    1.55 +print "@create_iso_command\n";
    1.56 +system(@create_iso_command);
    1.57 +
    1.58 +print "Created $tmp_iso.\n";
    1.59 +print "Use burn-tmp-iso-image to write to CD.\n";
    1.60 +if ($multi_sessionP){
    1.61 +    print "Note: this will be a multisession disk!.\n"
    1.62 +}
    1.63 +
    1.64 +# #START=`cdrecord -msinfo`
    1.65 +
    1.66 +# #echo "$START"
    1.67 +
    1.68 +# GRAFT_POINTS=''
    1.69 +
    1.70 +# for var in "$@"
    1.71 +# do 
    1.72 +#     GRAFT_POINTS="$GRAFT_POINTS \"`basename "$var"`\"=\"$var\""
    1.73 +# done
    1.74 +
    1.75 +
    1.76 +# #echo $GRAFT_POINTS
    1.77 +
    1.78 +# #if [ "$START" == "0,0" ]; then
    1.79 +#    COMMAND="mkisofs -iso-level 4 -rJT -o $TARGET -graft-points $GRAFT_POINTS"
    1.80 +# #   echo $COMMAND
    1.81 +# #   eval $COMMAND
    1.82 +# #else 
    1.83 +# #   COMMAND="mkisofs -iso-level 4 -rJT -M /dev/cdrom \
    1.84 +# #               -C $START -o $TARGET -graft-points $GRAFT_POINTS"
    1.85 +#    echo $COMMAND
    1.86 +#    eval $COMMAND
    1.87 +# #fi
    1.88 +
    1.89 +
    1.90 +# echo "files copied to $TARGET. use 'burn-tmp-iso-image' to burn it."
    1.91 +
    1.92 +# #cd-burn
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/cd-backup.pl	Mon Feb 25 13:30:46 2013 +0000
     2.3 @@ -0,0 +1,90 @@
     2.4 +#!/bin/perl
     2.5 +
     2.6 +$tmp_iso="/home/r/tmp/image.iso";
     2.7 +
     2.8 +
     2.9 +use File::Basename;
    2.10 +
    2.11 +$session_info = `cdrecord -minfo 2>/dev/null`;
    2.12 +$multi_sessionP = false;
    2.13 +
    2.14 +
    2.15 +# get the last 2 lines from $session_info, and use them to construct
    2.16 +# the proper flags for mkisofs.
    2.17 +
    2.18 +@session_info_lines = split("\n", $session_info);
    2.19 +
    2.20 +$session_number_line = $session_info_lines[-2];
    2.21 +$start_address_line  = $session_info_lines[-1];
    2.22 +
    2.23 +if ($session_number_line =~ m/^Last session start address:\s*(\d+)/){
    2.24 +    $session_number = $1;
    2.25 +    if ($start_address_line =~ m/^Last session leadout start address:\s*(\d+)/){
    2.26 +	$start_address = $1;
    2.27 +	$multi_sessionP = true;
    2.28 +    }
    2.29 +}
    2.30 +
    2.31 +#print "$multi_sessionP\n$session_number\n$start_address\n";
    2.32 +
    2.33 +@graft_points = ("-graft-points");
    2.34 +
    2.35 +for $graft_point(@ARGV){
    2.36 +    push(@graft_points, basename($graft_point) . "=" . $graft_point);
    2.37 +}
    2.38 +
    2.39 +@create_iso_command =  ("mkisofs", "-iso-level", "4", "-r", "-J", "-T");
    2.40 +
    2.41 +
    2.42 +if ($multi_sessionP){
    2.43 +#    $C_spec = "$session_number,$start_address";
    2.44 +    $C_spec = "1,$start_address";
    2.45 +    @additional_args = ("-M", "/dev/cdrom", "-C", $C_spec);
    2.46 +    @create_iso_command = (@create_iso_command, @additional_args);
    2.47 +}
    2.48 +    
    2.49 +@create_iso_command = (@create_iso_command, "-o", $tmp_iso, @graft_points);
    2.50 +
    2.51 +
    2.52 +@remove_previous_iso_command = ("rm", "-f", $tmp_iso);
    2.53 +print "@remove_previous_iso_command\n";
    2.54 +system(@remove_previous_iso_command);
    2.55 +
    2.56 +print "@create_iso_command\n";
    2.57 +system(@create_iso_command);
    2.58 +
    2.59 +print "Created $tmp_iso.\n";
    2.60 +print "Use burn-tmp-iso-image to write to CD.\n";
    2.61 +if ($multi_sessionP){
    2.62 +    print "Note: this will be a multisession disk!.\n"
    2.63 +}
    2.64 +
    2.65 +# #START=`cdrecord -msinfo`
    2.66 +
    2.67 +# #echo "$START"
    2.68 +
    2.69 +# GRAFT_POINTS=''
    2.70 +
    2.71 +# for var in "$@"
    2.72 +# do 
    2.73 +#     GRAFT_POINTS="$GRAFT_POINTS \"`basename "$var"`\"=\"$var\""
    2.74 +# done
    2.75 +
    2.76 +
    2.77 +# #echo $GRAFT_POINTS
    2.78 +
    2.79 +# #if [ "$START" == "0,0" ]; then
    2.80 +#    COMMAND="mkisofs -iso-level 4 -rJT -o $TARGET -graft-points $GRAFT_POINTS"
    2.81 +# #   echo $COMMAND
    2.82 +# #   eval $COMMAND
    2.83 +# #else 
    2.84 +# #   COMMAND="mkisofs -iso-level 4 -rJT -M /dev/cdrom \
    2.85 +# #               -C $START -o $TARGET -graft-points $GRAFT_POINTS"
    2.86 +#    echo $COMMAND
    2.87 +#    eval $COMMAND
    2.88 +# #fi
    2.89 +
    2.90 +
    2.91 +# echo "files copied to $TARGET. use 'burn-tmp-iso-image' to burn it."
    2.92 +
    2.93 +# #cd-burn
     3.1 --- a/cd-backup.sh	Mon Feb 25 09:35:08 2013 +0000
     3.2 +++ b/cd-backup.sh	Mon Feb 25 13:30:46 2013 +0000
     3.3 @@ -24,7 +24,7 @@
     3.4  #   COMMAND="mkisofs -iso-level 4 -rJT -M /dev/cdrom \
     3.5  #               -C $START -o $TARGET -graft-points $GRAFT_POINTS"
     3.6     echo $COMMAND
     3.7 -   eval $COMMAND
     3.8 +#   eval $COMMAND
     3.9  #fi
    3.10  
    3.11  
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/simple-cd-backup.pl	Mon Feb 25 13:30:46 2013 +0000
     4.3 @@ -0,0 +1,26 @@
     4.4 +#!/bin/perl
     4.5 +use File::Basename;
     4.6 +
     4.7 +$tmp_iso="/home/r/tmp/image.iso";
     4.8 +
     4.9 +@graft_points = ("-graft-points");
    4.10 +
    4.11 +for $graft_point(@ARGV){
    4.12 +    push(@graft_points, basename($graft_point) . "=" . $graft_point);
    4.13 +}
    4.14 +
    4.15 +@create_iso_command =  ("mkisofs", "-iso-level", "4", "-r", "-J", "-T");
    4.16 +
    4.17 +@create_iso_command = (@create_iso_command, "-o", $tmp_iso, @graft_points);
    4.18 +
    4.19 +
    4.20 +@remove_previous_iso_command = ("rm", "-f", $tmp_iso);
    4.21 +print "@remove_previous_iso_command\n";
    4.22 +system(@remove_previous_iso_command);
    4.23 +
    4.24 +print "@create_iso_command\n";
    4.25 +system(@create_iso_command);
    4.26 +
    4.27 +print "Created $tmp_iso.\n";
    4.28 +print "Use burn-tmp-iso-image to write to CD.\n";
    4.29 +