view cd-backup-parse.pl @ 10:07bb57b65da1

pipeline burning appears to work.
author Robert McIntyre <rlm@mit.edu>
date Mon, 25 Feb 2013 14:15:13 +0000
parents e736b9aaf5ad
children
line wrap: on
line source
1 #!/bin/perl
3 $tmp_iso="/home/r/tmp/image.iso";
6 use File::Basename;
8 $session_info = `cdrecord -minfo 2>/dev/null`;
9 $multi_sessionP = false;
12 # get the last 2 lines from $session_info, and use them to construct
13 # the proper flags for mkisofs.
15 @session_info_lines = split("\n", $session_info);
17 $session_number_line = $session_info_lines[-2];
18 $start_address_line = $session_info_lines[-1];
20 if ($session_number_line =~ m/^Last session start address:\s*(\d+)/){
21 $session_number = $1;
22 if ($start_address_line =~ m/^Last session leadout start address:\s*(\d+)/){
23 $start_address = $1;
24 $multi_sessionP = true;
25 }
26 }
28 #print "$multi_sessionP\n$session_number\n$start_address\n";
30 @graft_points = ("-graft-points");
32 for $graft_point(@ARGV){
33 push(@graft_points, basename($graft_point) . "=" . $graft_point);
34 }
36 @create_iso_command = ("mkisofs", "-iso-level", "4", "-r", "-J", "-T");
39 if ($multi_sessionP){
40 $C_spec = "$session_number,$start_address";
41 @additional_args = ("-M", "/dev/cdrom", "-C", $C_spec);
42 @create_iso_command = (@create_iso_command, @additional_args);
43 }
45 @create_iso_command = (@create_iso_command, "-o", $tmp_iso, @graft_points);
48 @remove_previous_iso_command = ("rm", "-f", $tmp_iso);
49 print "@remove_previous_iso_command\n";
50 system(@remove_previous_iso_command);
52 print "@create_iso_command\n";
53 system(@create_iso_command);
55 print "Created $tmp_iso.\n";
56 print "Use burn-tmp-iso-image to write to CD.\n";
57 if ($multi_sessionP){
58 print "Note: this will be a multisession disk!.\n"
59 }
61 # #START=`cdrecord -msinfo`
63 # #echo "$START"
65 # GRAFT_POINTS=''
67 # for var in "$@"
68 # do
69 # GRAFT_POINTS="$GRAFT_POINTS \"`basename "$var"`\"=\"$var\""
70 # done
73 # #echo $GRAFT_POINTS
75 # #if [ "$START" == "0,0" ]; then
76 # COMMAND="mkisofs -iso-level 4 -rJT -o $TARGET -graft-points $GRAFT_POINTS"
77 # # echo $COMMAND
78 # # eval $COMMAND
79 # #else
80 # # COMMAND="mkisofs -iso-level 4 -rJT -M /dev/cdrom \
81 # # -C $START -o $TARGET -graft-points $GRAFT_POINTS"
82 # echo $COMMAND
83 # eval $COMMAND
84 # #fi
87 # echo "files copied to $TARGET. use 'burn-tmp-iso-image' to burn it."
89 # #cd-burn