1 |
slords |
1.1 |
diff -Nur -x '*.orig' -x '*.rej' smeserver-arkeia-1.0/root/etc/e-smith/events/actions/conf-arkeia mezzanine_patched_smeserver-arkeia-1.0/root/etc/e-smith/events/actions/conf-arkeia |
2 |
|
|
--- smeserver-arkeia-1.0/root/etc/e-smith/events/actions/conf-arkeia 2007-07-10 10:04:23.000000000 -0600 |
3 |
|
|
+++ mezzanine_patched_smeserver-arkeia-1.0/root/etc/e-smith/events/actions/conf-arkeia 2007-07-10 10:03:33.000000000 -0600 |
4 |
|
|
@@ -5,18 +5,17 @@ |
5 |
|
|
use strict; |
6 |
|
|
use esmith::ConfigDB; |
7 |
|
|
use esmith::templates; |
8 |
|
|
-use Data::Dumper; |
9 |
|
|
|
10 |
|
|
sub check_arkc { |
11 |
|
|
- my $object = shift; |
12 |
|
|
- my $name = shift; |
13 |
|
|
- my @params = @_; |
14 |
|
|
- |
15 |
|
|
- open(ARKC, "/usr/bin/arkc -$object -list -noinfo 2>&1 |"); |
16 |
|
|
- my %list = map { chomp; /name=(.*)/; $1 => 1 } <ARKC>; |
17 |
|
|
- close ARKC; |
18 |
|
|
+ my $object = shift; |
19 |
|
|
+ my $name = shift; |
20 |
|
|
+ my @params = @_; |
21 |
|
|
+ |
22 |
|
|
+ open(ARKC, "/usr/bin/arkc -$object -list -noinfo 2>&1 |"); |
23 |
|
|
+ my %list = map { chomp; /name=(.*)/; $1 => 1 } <ARKC>; |
24 |
|
|
+ close ARKC; |
25 |
|
|
|
26 |
|
|
- system(qw(/usr/bin/arkc -create), "-$object", qw(-noinfo -D), "name=[$name]", @params) unless $list{$name} |
27 |
|
|
+ system(qw(/usr/bin/arkc -create), "-$object", qw(-noinfo -D), "name=[$name]", @params) unless $list{$name} |
28 |
|
|
} |
29 |
|
|
|
30 |
|
|
my $cdb = esmith::ConfigDB->open; |
31 |
|
|
@@ -24,17 +23,20 @@ |
32 |
|
|
my $arkeia = $cdb->get('arkeia') or die "No arkeia db entry found\n"; |
33 |
|
|
my $machinename = $cdb->get('SystemName')->value.".".$cdb->get('DomainName')->value; |
34 |
|
|
|
35 |
|
|
+my $drv = 'unknown'; |
36 |
|
|
+my $dev = 'unknown'; |
37 |
|
|
open(DETECTHARDWARE, '/opt/arkeia/bin/arkdetect 2>&1 |'); |
38 |
|
|
while (<DETECTHARDWARE>) { |
39 |
|
|
- $arkeia->set_prop('Drive', $1) if m#PROP : 'ARK_MODEL 'VAL : '(.*)'#; |
40 |
|
|
- $backup->set_prop('Device', $1) if m#PROP : 'DEVICE 'VAL : '(.*)'#; |
41 |
|
|
+ $drv = $1 if m#PROP : 'ARK_MODEL 'VAL : '(.*)'#; |
42 |
|
|
+ $dev = $1 if m#PROP : 'DEVICE 'VAL : '(.*)'#; |
43 |
|
|
+ last if m#LIBRARIES#; |
44 |
|
|
} |
45 |
|
|
close DETECTHARDWARE; |
46 |
|
|
|
47 |
|
|
my $networkfound = 0; |
48 |
|
|
open(NETWORK, '/sbin/ifconfig 2>&1 |'); |
49 |
|
|
while (<NETWORK>) { |
50 |
|
|
- ++$networkfound if (m#inet addr:\s*\d+\.#); |
51 |
|
|
+ ++$networkfound if (m#inet addr:\s*\d+\.#); |
52 |
|
|
} |
53 |
|
|
close NETWORK; |
54 |
|
|
exit(0) unless $networkfound; |
55 |
|
|
@@ -46,11 +48,11 @@ |
56 |
|
|
close USERLIST; |
57 |
|
|
|
58 |
|
|
unless ($userlist{admin}) { |
59 |
|
|
- my $password = esmith::util::LdapPassword(); |
60 |
|
|
- system(qw(/usr/bin/arkc -user -create -noinfo -D name=admin role=ADMINISTRATOR), |
61 |
|
|
- "email=[admin\@".$cdb->get('DomainName')->value."]", "node=$machinename", "passwd=[$password]", "vpasswd=[$password]"); |
62 |
|
|
+ my $password = esmith::util::LdapPassword(); |
63 |
|
|
+ system(qw(/usr/bin/arkc -user -create -noinfo -D name=admin role=ADMINISTRATOR), |
64 |
|
|
+ "email=[admin\@".$cdb->get('DomainName')->value."]", "node=$machinename", "passwd=[$password]", "vpasswd=[$password]"); |
65 |
|
|
|
66 |
|
|
- processTemplate ({TEMPLATE_PATH => "/opt/arkeia/arkc/arkc.param"}); |
67 |
|
|
+ processTemplate ({TEMPLATE_PATH => "/opt/arkeia/arkc/arkc.param"}); |
68 |
|
|
} |
69 |
|
|
|
70 |
|
|
open(USERLIST, '/usr/bin/arkc -user -list -noinfo 2>&1 |'); |
71 |
|
|
@@ -58,22 +60,38 @@ |
72 |
|
|
close USERLIST; |
73 |
|
|
exit(0) unless $userlist{admin}; |
74 |
|
|
|
75 |
|
|
-my $device = $backup->prop('Device') || '/dev/st0'; |
76 |
|
|
-my $drive = $arkeia->prop('Drive') || 'none'; |
77 |
|
|
+my $device = $backup->prop('Device') || 'unknown'; |
78 |
|
|
+my $drive = $arkeia->prop('Drive') || 'unknown'; |
79 |
|
|
+if ($drive eq 'unknown' && $drv ne 'unknown') { |
80 |
|
|
+ $arkeia->set_prop('Drive', $drv); |
81 |
|
|
+ $backup->set_prop('Device', $dev); |
82 |
|
|
+ $drive = $drv; |
83 |
|
|
+ $device = $dev; |
84 |
|
|
+} elsif ($device eq 'unknown' && $dev ne 'unknown') { |
85 |
|
|
+ $backup->set_prop('Device', $dev); |
86 |
|
|
+ $device = $dev; |
87 |
|
|
+} |
88 |
|
|
|
89 |
|
|
open(DRIVETYPE, '/usr/bin/arkc -drive -type -noinfo 2>&1 |'); |
90 |
|
|
my %drivetype = map { chomp; /name=(.*)/; $1 => 1 } <DRIVETYPE>; |
91 |
|
|
close DRIVETYPE; |
92 |
|
|
-exit(0) unless $drivetype{$drive}; |
93 |
|
|
+unless ($drivetype{$drive}) { |
94 |
|
|
+ exit 0 unless $drivetype{$drv}; |
95 |
|
|
+ |
96 |
|
|
+ $arkeia->set_prop('Drive', $drv); |
97 |
|
|
+ $backup->set_prop('Device', $dev); |
98 |
|
|
+ $drive = $drv; |
99 |
|
|
+ $device = $dev; |
100 |
|
|
+} |
101 |
|
|
|
102 |
|
|
open(DRIVE, '/usr/bin/arkc -drive -list -noinfo -D name=[Tape Drive] 2>&1 |'); |
103 |
|
|
my %driveinfo = map { chomp; /(.*)=(.*)/; $1 => $2 } <DRIVE>; |
104 |
|
|
close DRIVE; |
105 |
|
|
|
106 |
|
|
unless (($driveinfo{DRV_TYPE} || '') eq $drive && ($driveinfo{REWIND_DEV} || '') eq $device) { |
107 |
|
|
- system(qw(/usr/bin/arkc -drivepack -delete -noinfo -D), "name=[Drive Pack]"); |
108 |
|
|
- system(qw(/usr/bin/arkc -drive -delete -noinfo -D), "name=[Tape Drive]"); |
109 |
|
|
- system(qw(/usr/bin/arkc -drive -create -noinfo -D), "name=[Tape Drive]", "type=[$drive]", "rewind_dev=[$device]"); |
110 |
|
|
+ system(qw(/usr/bin/arkc -drivepack -delete -noinfo -D), "name=[Drive Pack]"); |
111 |
|
|
+ system(qw(/usr/bin/arkc -drive -delete -noinfo -D), "name=[Tape Drive]"); |
112 |
|
|
+ system(qw(/usr/bin/arkc -drive -create -noinfo -D), "name=[Tape Drive]", "type=[$drive]", "rewind_dev=[$device]"); |
113 |
|
|
} |
114 |
|
|
|
115 |
|
|
check_arkc('drivepack', 'Drive Pack', 'drvname=[Tape Drive]'); |
116 |
|
|
@@ -84,7 +102,7 @@ |
117 |
|
|
close SAVEPACK; |
118 |
|
|
|
119 |
|
|
unless (($savepack{FULLNAME} || '') eq $machinename) { |
120 |
|
|
- system(qw(/usr/bin/arkc -savepack -delete -noinfo -D), "name=[Save Pack]"); |
121 |
|
|
- system(qw(/usr/bin/arkc -savepack -create -noinfo -D), "name=[Save Pack]"); |
122 |
|
|
- system(qw(/usr/bin/arkc -savepack -modify -noinfo -D), "name=[Save Pack]", "tree_name=$machinename"); |
123 |
|
|
+ system(qw(/usr/bin/arkc -savepack -delete -noinfo -D), "name=[Save Pack]"); |
124 |
|
|
+ system(qw(/usr/bin/arkc -savepack -create -noinfo -D), "name=[Save Pack]"); |
125 |
|
|
+ system(qw(/usr/bin/arkc -savepack -modify -noinfo -D), "name=[Save Pack]", "tree_name=$machinename"); |
126 |
|
|
} |