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

move cruft.
author Robert McIntyre <rlm@mit.edu>
date Thu, 23 May 2013 22:52:01 -0400
parents cd-backup.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.pl	Thu May 23 22:52:01 2013 -0400
     1.3 @@ -0,0 +1,90 @@
     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 +    $C_spec = "1,$start_address";
    1.45 +    @additional_args = ("-M", "/dev/cdrom", "-C", $C_spec);
    1.46 +    @create_iso_command = (@create_iso_command, @additional_args);
    1.47 +}
    1.48 +    
    1.49 +@create_iso_command = (@create_iso_command, "-o", $tmp_iso, @graft_points);
    1.50 +
    1.51 +
    1.52 +@remove_previous_iso_command = ("rm", "-f", $tmp_iso);
    1.53 +print "@remove_previous_iso_command\n";
    1.54 +system(@remove_previous_iso_command);
    1.55 +
    1.56 +print "@create_iso_command\n";
    1.57 +system(@create_iso_command);
    1.58 +
    1.59 +print "Created $tmp_iso.\n";
    1.60 +print "Use burn-tmp-iso-image to write to CD.\n";
    1.61 +if ($multi_sessionP){
    1.62 +    print "Note: this will be a multisession disk!.\n"
    1.63 +}
    1.64 +
    1.65 +# #START=`cdrecord -msinfo`
    1.66 +
    1.67 +# #echo "$START"
    1.68 +
    1.69 +# GRAFT_POINTS=''
    1.70 +
    1.71 +# for var in "$@"
    1.72 +# do 
    1.73 +#     GRAFT_POINTS="$GRAFT_POINTS \"`basename "$var"`\"=\"$var\""
    1.74 +# done
    1.75 +
    1.76 +
    1.77 +# #echo $GRAFT_POINTS
    1.78 +
    1.79 +# #if [ "$START" == "0,0" ]; then
    1.80 +#    COMMAND="mkisofs -iso-level 4 -rJT -o $TARGET -graft-points $GRAFT_POINTS"
    1.81 +# #   echo $COMMAND
    1.82 +# #   eval $COMMAND
    1.83 +# #else 
    1.84 +# #   COMMAND="mkisofs -iso-level 4 -rJT -M /dev/cdrom \
    1.85 +# #               -C $START -o $TARGET -graft-points $GRAFT_POINTS"
    1.86 +#    echo $COMMAND
    1.87 +#    eval $COMMAND
    1.88 +# #fi
    1.89 +
    1.90 +
    1.91 +# echo "files copied to $TARGET. use 'burn-tmp-iso-image' to burn it."
    1.92 +
    1.93 +# #cd-burn