diff crvft/cd-backup-parse.pl @ 19:e2bef5c2dc28

move cruft.
author Robert McIntyre <rlm@mit.edu>
date Thu, 23 May 2013 22:52:01 -0400
parents cd-backup-parse.pl@e736b9aaf5ad
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/crvft/cd-backup-parse.pl	Thu May 23 22:52:01 2013 -0400
     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