Mercurial > backup
comparison 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 |
comparison
equal
deleted
inserted
replaced
18:413c2abaaf76 | 19:e2bef5c2dc28 |
---|---|
1 #!/bin/perl | |
2 | |
3 $tmp_iso="/home/r/tmp/image.iso"; | |
4 | |
5 | |
6 use File::Basename; | |
7 | |
8 $session_info = `cdrecord -minfo 2>/dev/null`; | |
9 $multi_sessionP = false; | |
10 | |
11 | |
12 # get the last 2 lines from $session_info, and use them to construct | |
13 # the proper flags for mkisofs. | |
14 | |
15 @session_info_lines = split("\n", $session_info); | |
16 | |
17 $session_number_line = $session_info_lines[-2]; | |
18 $start_address_line = $session_info_lines[-1]; | |
19 | |
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 } | |
27 | |
28 #print "$multi_sessionP\n$session_number\n$start_address\n"; | |
29 | |
30 @graft_points = ("-graft-points"); | |
31 | |
32 for $graft_point(@ARGV){ | |
33 push(@graft_points, basename($graft_point) . "=" . $graft_point); | |
34 } | |
35 | |
36 @create_iso_command = ("mkisofs", "-iso-level", "4", "-r", "-J", "-T"); | |
37 | |
38 | |
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 } | |
44 | |
45 @create_iso_command = (@create_iso_command, "-o", $tmp_iso, @graft_points); | |
46 | |
47 | |
48 @remove_previous_iso_command = ("rm", "-f", $tmp_iso); | |
49 print "@remove_previous_iso_command\n"; | |
50 system(@remove_previous_iso_command); | |
51 | |
52 print "@create_iso_command\n"; | |
53 system(@create_iso_command); | |
54 | |
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 } | |
60 | |
61 # #START=`cdrecord -msinfo` | |
62 | |
63 # #echo "$START" | |
64 | |
65 # GRAFT_POINTS='' | |
66 | |
67 # for var in "$@" | |
68 # do | |
69 # GRAFT_POINTS="$GRAFT_POINTS \"`basename "$var"`\"=\"$var\"" | |
70 # done | |
71 | |
72 | |
73 # #echo $GRAFT_POINTS | |
74 | |
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 | |
85 | |
86 | |
87 # echo "files copied to $TARGET. use 'burn-tmp-iso-image' to burn it." | |
88 | |
89 # #cd-burn |