Mercurial > backup
comparison 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 |
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 $C_spec = "1,$start_address"; | |
42 @additional_args = ("-M", "/dev/cdrom", "-C", $C_spec); | |
43 @create_iso_command = (@create_iso_command, @additional_args); | |
44 } | |
45 | |
46 @create_iso_command = (@create_iso_command, "-o", $tmp_iso, @graft_points); | |
47 | |
48 | |
49 @remove_previous_iso_command = ("rm", "-f", $tmp_iso); | |
50 print "@remove_previous_iso_command\n"; | |
51 system(@remove_previous_iso_command); | |
52 | |
53 print "@create_iso_command\n"; | |
54 system(@create_iso_command); | |
55 | |
56 print "Created $tmp_iso.\n"; | |
57 print "Use burn-tmp-iso-image to write to CD.\n"; | |
58 if ($multi_sessionP){ | |
59 print "Note: this will be a multisession disk!.\n" | |
60 } | |
61 | |
62 # #START=`cdrecord -msinfo` | |
63 | |
64 # #echo "$START" | |
65 | |
66 # GRAFT_POINTS='' | |
67 | |
68 # for var in "$@" | |
69 # do | |
70 # GRAFT_POINTS="$GRAFT_POINTS \"`basename "$var"`\"=\"$var\"" | |
71 # done | |
72 | |
73 | |
74 # #echo $GRAFT_POINTS | |
75 | |
76 # #if [ "$START" == "0,0" ]; then | |
77 # COMMAND="mkisofs -iso-level 4 -rJT -o $TARGET -graft-points $GRAFT_POINTS" | |
78 # # echo $COMMAND | |
79 # # eval $COMMAND | |
80 # #else | |
81 # # COMMAND="mkisofs -iso-level 4 -rJT -M /dev/cdrom \ | |
82 # # -C $START -o $TARGET -graft-points $GRAFT_POINTS" | |
83 # echo $COMMAND | |
84 # eval $COMMAND | |
85 # #fi | |
86 | |
87 | |
88 # echo "files copied to $TARGET. use 'burn-tmp-iso-image' to burn it." | |
89 | |
90 # #cd-burn |