6955
|
1 |
diff -ru /var/tmp/clean/system-tools-backends-1.4.2/file.pl.in system-tools-backends-1.4.2/file.pl.in
|
|
2 |
--- /var/tmp/clean/system-tools-backends-1.4.2/file.pl.in 2005-11-04 15:49:36.000000000 +0000
|
|
3 |
+++ system-tools-backends-1.4.2/file.pl.in 2006-03-13 10:14:56.141636000 +0000
|
|
4 |
@@ -772,6 +772,14 @@
|
|
5 |
}
|
|
6 |
}
|
|
7 |
|
|
8 |
+sub gst_file_read_joined_lines
|
|
9 |
+{
|
|
10 |
+ my ($file) = @_;
|
|
11 |
+ my $buffer = &gst_file_buffer_load ($file);
|
|
12 |
+ &gst_file_buffer_join_lines ($buffer);
|
|
13 |
+ $$buffer[0] =~ s/\n//; $$buffer[0] =~ s/\\//;
|
|
14 |
+ return $$buffer[0];
|
|
15 |
+}
|
|
16 |
|
|
17 |
# --- Command-line utilities --- #
|
|
18 |
|
|
19 |
diff -ru /var/tmp/clean/system-tools-backends-1.4.2/partition.pl.in system-tools-backends-1.4.2/partition.pl.in
|
|
20 |
--- /var/tmp/clean/system-tools-backends-1.4.2/partition.pl.in 2004-11-05 17:03:26.000000000 +0000
|
|
21 |
+++ system-tools-backends-1.4.2/partition.pl.in 2006-03-13 10:14:56.152216000 +0000
|
|
22 |
@@ -86,6 +86,17 @@
|
|
23 |
},
|
|
24 |
);
|
|
25 |
|
|
26 |
+sub gst_partition_scan_sunos_info
|
|
27 |
+{
|
|
28 |
+ my ($fd, $line);
|
|
29 |
+ my (%hash);
|
|
30 |
+ my (@table);
|
|
31 |
+
|
|
32 |
+ $hash{"partition"} = \@table;
|
|
33 |
+
|
|
34 |
+ return \%hash;
|
|
35 |
+}
|
|
36 |
+
|
|
37 |
sub gst_partition_scan_freebsd_info
|
|
38 |
{
|
|
39 |
my ($fd, $line);
|
|
40 |
@@ -192,6 +203,7 @@
|
|
41 |
|
|
42 |
return &gst_partition_scan_linux_info if ($plat eq "Linux");
|
|
43 |
return &gst_partition_scan_freebsd_info if ($plat eq "FreeBSD");
|
|
44 |
+ return &gst_partition_scan_sunos_info if ($plat eq "SunOS");
|
|
45 |
}
|
|
46 |
|
|
47 |
%GST_FILESYS_TYPES =
|
|
48 |
diff -ru /var/tmp/clean/system-tools-backends-1.4.2/platform.pl.in system-tools-backends-1.4.2/platform.pl.in
|
|
49 |
--- /var/tmp/clean/system-tools-backends-1.4.2/platform.pl.in 2006-01-02 15:32:34.000000000 +0000
|
|
50 |
+++ system-tools-backends-1.4.2/platform.pl.in 2006-03-13 10:14:56.152576000 +0000
|
|
51 |
@@ -38,6 +38,8 @@
|
|
52 |
|
|
53 |
|
|
54 |
$PLATFORM_INFO = {
|
|
55 |
+ "solaris-2.11" => "Solaris Nevada / Open Solaris",
|
|
56 |
+ "nexenta-1.0" => "Nexenta GNU/Solaris 1.0 Ellate",
|
|
57 |
"debian-2.2" => "Debian GNU/Linux 2.2 Potato",
|
|
58 |
"debian-3.0" => "Debian GNU/Linux 3.0 Woody",
|
|
59 |
"debian-sarge" => "Debian GNU/Linux Sarge",
|
|
60 |
@@ -110,7 +112,8 @@
|
|
61 |
("Debian" => "debian"),
|
|
62 |
("Mandrake" => "mandrake"),
|
|
63 |
("Conectiva" => "conectiva"),
|
|
64 |
- ("Blackpanther" => "blackpanther");
|
|
65 |
+ ("Blackpanther" => "blackpanther"),
|
|
66 |
+ ("gnu_solaris" => "nexenta");
|
|
67 |
|
|
68 |
# gst_prefix not required here: parse already does that for us.
|
|
69 |
$dist = lc (&gst_parse_sh ("/etc/lsb-release", "DISTRIB_ID"));
|
|
70 |
@@ -528,9 +531,11 @@
|
|
71 |
chomp ($dist = <$fd>);
|
|
72 |
&gst_file_close ($fd);
|
|
73 |
|
|
74 |
- if ($dist =~ /^5\.(\d)/) { return "solaris-2.$1" }
|
|
75 |
- else { if ($dist =~ /^([78])\.\d/) { return "solaris-$1.0" } }
|
|
76 |
- return -1;
|
|
77 |
+ if (-f "$gst_prefix/etc/debian_version") { return check_lsb() }
|
|
78 |
+ else {
|
|
79 |
+ if ($dist =~ /^5\.(\d+)/) { return "solaris-2.$1" }
|
|
80 |
+ else { return -1 }
|
|
81 |
+ }
|
|
82 |
}
|
|
83 |
|
|
84 |
sub gst_platform_get_system
|
|
85 |
diff -ru /var/tmp/clean/system-tools-backends-1.4.2/service.pl.in system-tools-backends-1.4.2/service.pl.in
|
|
86 |
--- /var/tmp/clean/system-tools-backends-1.4.2/service.pl.in 2006-01-02 15:42:19.000000000 +0000
|
|
87 |
+++ system-tools-backends-1.4.2/service.pl.in 2006-03-13 10:14:56.155005000 +0000
|
|
88 |
@@ -85,6 +85,9 @@
|
|
89 |
"ubuntu-5.10" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
|
|
90 |
"ubuntu-6.04" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
|
|
91 |
|
|
92 |
+ "nexenta-1.0" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
|
|
93 |
+ "solaris-2.11" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
|
|
94 |
+
|
|
95 |
"suse-7.0" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d", "../"],
|
|
96 |
"suse-9.0" => ["$gst_prefix/etc/init.d", "$gst_prefix/etc/init.d", "../"],
|
|
97 |
"suse-9.1" => ["$gst_prefix/etc/init.d", "$gst_prefix/etc/init.d", "../"],
|
|
98 |
@@ -154,6 +157,9 @@
|
|
99 |
"ubuntu-5.04" => [2, 3],
|
|
100 |
"ubuntu-5.10" => [2, 3],
|
|
101 |
"ubuntu-6.04" => [2, 3],
|
|
102 |
+
|
|
103 |
+ "nexenta-1.0" => [2, 3],
|
|
104 |
+ "solaris-2.11" => [2, 3],
|
|
105 |
|
|
106 |
"suse-7.0" => [3, 5],
|
|
107 |
"suse-9.0" => [3, 5],
|
|
108 |
@@ -223,6 +229,10 @@
|
|
109 |
"ubuntu-5.04" => "debian-2.2",
|
|
110 |
"ubuntu-5.10" => "debian-2.2",
|
|
111 |
"ubuntu-6.04" => "debian-2.2",
|
|
112 |
+
|
|
113 |
+ "nexenta-1.0" => "nexenta",
|
|
114 |
+
|
|
115 |
+ "solaris-2.11" => "solaris",
|
|
116 |
|
|
117 |
"suse-7.0" => "redhat-5.2",
|
|
118 |
"suse-9.0" => "redhat-5.2",
|
|
119 |
@@ -277,6 +287,14 @@
|
|
120 |
"default" => "GRAPHICAL",
|
|
121 |
"nonetwork" => "RECOVER"
|
|
122 |
},
|
|
123 |
+ "nexenta" => {"single-user" => "TEXT",
|
|
124 |
+ "multi-user" => "GRAPHICAL",
|
|
125 |
+ "none" => "RECOVER"
|
|
126 |
+ },
|
|
127 |
+ "solaris" => {"single-user" => "TEXT",
|
|
128 |
+ "multi-user" => "GRAPHICAL",
|
|
129 |
+ "none" => "RECOVER"
|
|
130 |
+ },
|
|
131 |
"freebsd-5" => {"rc" => "GRAPHICAL" },
|
|
132 |
"slackware-9.1.0" => {"4" => "GRAPHICAL" }
|
|
133 |
);
|
|
134 |
@@ -797,6 +815,152 @@
|
|
135 |
return \%ret;
|
|
136 |
}
|
|
137 |
|
|
138 |
+sub gst_service_smf_service_exist
|
|
139 |
+{
|
|
140 |
+ my($service) = @_;
|
|
141 |
+ my($services) = &gst_service_smf_get_services_list();
|
|
142 |
+
|
|
143 |
+ foreach $i (@$services)
|
|
144 |
+ {
|
|
145 |
+ return 1 if ($i =~ /$service/);
|
|
146 |
+ }
|
|
147 |
+
|
|
148 |
+ return 0;
|
|
149 |
+}
|
|
150 |
+
|
|
151 |
+sub gst_service_smf_run_svcadm
|
|
152 |
+{
|
|
153 |
+ my ($service, $arg) = @_;
|
|
154 |
+ my ($option);
|
|
155 |
+
|
|
156 |
+ my %map =
|
|
157 |
+ ("stop" => "stopped",
|
|
158 |
+ "start" => "started"
|
|
159 |
+ );
|
|
160 |
+
|
|
161 |
+ my %op =
|
|
162 |
+ ("stop" => "disable",
|
|
163 |
+ "start" => "enable"
|
|
164 |
+ );
|
|
165 |
+
|
|
166 |
+ &gst_report_enter ();
|
|
167 |
+
|
|
168 |
+ if (!exists $map{$arg})
|
|
169 |
+ {
|
|
170 |
+ &gst_report ("service_sysv_op_unk", $arg);
|
|
171 |
+ &gst_report_leave ();
|
|
172 |
+ return -1;
|
|
173 |
+ }
|
|
174 |
+
|
|
175 |
+ if (&gst_service_smf_service_exist ($service))
|
|
176 |
+ {
|
|
177 |
+ if (!&gst_file_run ("svcadm $op{$arg} $service"))
|
|
178 |
+ {
|
|
179 |
+ &gst_report ("service_sysv_op_success", $service, $str);
|
|
180 |
+ &gst_report_leave ();
|
|
181 |
+ return 0;
|
|
182 |
+ }
|
|
183 |
+ }
|
|
184 |
+
|
|
185 |
+ &gst_report ("service_sysv_op_failed", $service, $str);
|
|
186 |
+ &gst_report_leave ();
|
|
187 |
+ return -1;
|
|
188 |
+}
|
|
189 |
+
|
|
190 |
+sub gst_service_smf_runlevel_status_by_service
|
|
191 |
+{
|
|
192 |
+ my ($service, $status) = @_;
|
|
193 |
+ my (@arr, @ret);
|
|
194 |
+ my (@runlevels) = split(" ","single-user multi-user");
|
|
195 |
+
|
|
196 |
+ foreach $runlevel (@runlevels)
|
|
197 |
+ {
|
|
198 |
+ if ($status)
|
|
199 |
+ {
|
|
200 |
+ push @arr, { "name" => $runlevel,
|
|
201 |
+ "action" => "start" };
|
|
202 |
+ }
|
|
203 |
+ else
|
|
204 |
+ {
|
|
205 |
+ push @arr, { "name" => $runlevel,
|
|
206 |
+ "action" => "stop" };
|
|
207 |
+ }
|
|
208 |
+ }
|
|
209 |
+
|
|
210 |
+ push @ret, { "runlevel" => \@arr };
|
|
211 |
+ return @ret;
|
|
212 |
+}
|
|
213 |
+
|
|
214 |
+sub gst_service_smf_get_service_info
|
|
215 |
+{
|
|
216 |
+ my ($service) = @_;
|
|
217 |
+ my ($script, @actions, @runlevels);
|
|
218 |
+ my %hash;
|
|
219 |
+ my $role;
|
|
220 |
+ my $status = 0;
|
|
221 |
+ my $longname = "";
|
|
222 |
+
|
|
223 |
+ my $fd = &gst_file_run_pipe_read ("svcs -l $service");
|
|
224 |
+ while (<$fd>) {
|
|
225 |
+ $status = 1 if (/^state.*online/);
|
|
226 |
+ $longname = $1 if (/^name\s*(.*)/);
|
|
227 |
+ }
|
|
228 |
+ gst_file_close ($fd);
|
|
229 |
+
|
|
230 |
+ my($runlevels) = &gst_service_smf_runlevel_status_by_service ($service, $status);
|
|
231 |
+
|
|
232 |
+ $hash{"script"} = $service;
|
|
233 |
+ $hash{"longname"} = $longname if ($longname);
|
|
234 |
+ $hash{"runlevels"} = $runlevels unless ($runlevels eq undef);
|
|
235 |
+ $service =~ m/.*\/(.*)$/;
|
|
236 |
+ $role = &gst_service_get_role ($1);
|
|
237 |
+
|
|
238 |
+ if ($role eq "UNKNOWN") {
|
|
239 |
+ $role = "SYSTEM" if ($service =~ /^system\// || $service =~ /^platform\//);
|
|
240 |
+ $role = "NETWORK" if ($service =~ /^network\//);
|
|
241 |
+ $role = "NTP_SERVER" if ($service =~ /^network\/ntp/);
|
|
242 |
+ $role = "FILE_SERVER" if ($service =~ /^network\/nfs/);
|
|
243 |
+ $role = "DYNAMIC_DNS" if ($service =~ /^network\/dns/);
|
|
244 |
+ $role = "SYSTEM_LOGGER" if ($service =~ /^system\/system-log/);
|
|
245 |
+ }
|
|
246 |
+
|
|
247 |
+ $hash{"role"} = $role;
|
|
248 |
+
|
|
249 |
+ return \%hash;
|
|
250 |
+}
|
|
251 |
+
|
|
252 |
+sub gst_service_smf_get_services_list
|
|
253 |
+{
|
|
254 |
+ my @list;
|
|
255 |
+ local *SVCS=gst_file_run_pipe_read("svcs -a");
|
|
256 |
+ while (<SVCS>) {
|
|
257 |
+ next if (/svc:\/milestone/);
|
|
258 |
+ if (/^.*\s*.*\s*svc:\/(.*):.*/) {
|
|
259 |
+ push(@list,$1);
|
|
260 |
+ }
|
|
261 |
+ }
|
|
262 |
+ close (SVCS);
|
|
263 |
+
|
|
264 |
+ return \@list;
|
|
265 |
+}
|
|
266 |
+
|
|
267 |
+sub gst_service_smf_get_services
|
|
268 |
+{
|
|
269 |
+ my ($service);
|
|
270 |
+ my (%ret);
|
|
271 |
+ my ($service_list) = &gst_service_smf_get_services_list ();
|
|
272 |
+
|
|
273 |
+ foreach $service (@$service_list)
|
|
274 |
+ {
|
|
275 |
+ my (%hash);
|
|
276 |
+ $hash = &gst_service_smf_get_service_info ($service);
|
|
277 |
+
|
|
278 |
+ $ret{$service} = $hash if ($hash ne undef);
|
|
279 |
+ }
|
|
280 |
+
|
|
281 |
+ return \%ret;
|
|
282 |
+}
|
|
283 |
+
|
|
284 |
# these functions get a list of the services that run on a gentoo init
|
|
285 |
sub gst_service_gentoo_get_service_status
|
|
286 |
{
|
|
287 |
@@ -1163,6 +1327,10 @@
|
|
288 |
{
|
|
289 |
return "suse";
|
|
290 |
}
|
|
291 |
+ elsif ($gst_dist =~ /nexenta/ || $gst_dist =~ /solaris-2.11/)
|
|
292 |
+ {
|
|
293 |
+ return "smf";
|
|
294 |
+ }
|
|
295 |
else
|
|
296 |
{
|
|
297 |
return "sysv";
|
|
298 |
@@ -1180,6 +1348,8 @@
|
|
299 |
return &gst_service_rcng_get_services () if ($type eq "rcng");
|
|
300 |
return &gst_service_suse_get_services () if ($type eq "suse");
|
|
301 |
return &gst_service_archlinux_get_services() if ($type eq "archlinux");
|
|
302 |
+ return &gst_service_smf_get_services () if ($type eq "smf");
|
|
303 |
+
|
|
304 |
return undef;
|
|
305 |
}
|
|
306 |
|
|
307 |
@@ -1199,7 +1369,7 @@
|
|
308 |
{
|
|
309 |
my ($type) = &gst_get_init_type ();
|
|
310 |
|
|
311 |
- return "default" if ($type eq "gentoo");
|
|
312 |
+ return "default" if ($type eq "gentoo" || $type eq "smf");
|
|
313 |
return "rc" if ($type eq "rcng");
|
|
314 |
return "rc" if ($type eq "archlinux");
|
|
315 |
return &gst_service_sysv_get_default_runlevel ();
|
|
316 |
@@ -1585,6 +1755,7 @@
|
|
317 |
&gst_service_rcng_set_services ($services, $runlevel) if ($type eq "rcng");
|
|
318 |
&gst_service_suse_set_services ($services, $runlevel) if ($type eq "suse");
|
|
319 |
&gst_service_archlinux_set_services ($services, $runlevel) if ($type eq "archlinux");
|
|
320 |
+ &gst_service_smf_set_services ($services, $runlevel) if ($type eq "smf");
|
|
321 |
}
|
|
322 |
|
|
323 |
sub gst_service_set_conf
|
|
324 |
@@ -1632,6 +1803,47 @@
|
|
325 |
return undef;
|
|
326 |
}
|
|
327 |
|
|
328 |
+sub gst_service_smf_set_services
|
|
329 |
+{
|
|
330 |
+ my ($services, $runlevel) = @_;
|
|
331 |
+ my ($action);
|
|
332 |
+
|
|
333 |
+ foreach $service (@$services)
|
|
334 |
+ {
|
|
335 |
+ $script = $$service{"script"};
|
|
336 |
+ $arr = $$service{"runlevels"}[0]{"runlevel"};
|
|
337 |
+
|
|
338 |
+ foreach $i (@$arr)
|
|
339 |
+ {
|
|
340 |
+ $action = $$i{"action"};
|
|
341 |
+ $rl = $$i{"name"};
|
|
342 |
+
|
|
343 |
+ if ( $action eq "start")
|
|
344 |
+ {
|
|
345 |
+ &gst_file_run ("rc-update add $script $rl");
|
|
346 |
+ }
|
|
347 |
+ elsif ($action eq "stop")
|
|
348 |
+ {
|
|
349 |
+ &gst_file_run ("rc-update del $script $rl");
|
|
350 |
+ }
|
|
351 |
+ }
|
|
352 |
+ }
|
|
353 |
+}
|
|
354 |
+
|
|
355 |
+sub gst_service_smf_get_status
|
|
356 |
+{
|
|
357 |
+ my ($service) = @_;
|
|
358 |
+ my $ret = 0;
|
6962
|
359 |
+ my $fd = &gst_file_run_pipe_read ("svcs -H -ostate $service");
|
6955
|
360 |
+
|
|
361 |
+ while (<$fd>) {
|
|
362 |
+ if (/^online/) { $ret = 1; last; }
|
|
363 |
+ }
|
|
364 |
+ gst_file_close ($fd);
|
|
365 |
+
|
|
366 |
+ return $ret;
|
|
367 |
+}
|
|
368 |
+
|
|
369 |
sub gst_service_redhat_get_status
|
|
370 |
{
|
|
371 |
my ($service) = @_;
|
|
372 |
@@ -1697,6 +1909,9 @@
|
|
373 |
"ubuntu-5.04" => \&gst_service_debian_get_status,
|
|
374 |
"ubuntu-5.10" => \&gst_service_debian_get_status,
|
|
375 |
"ubuntu-6.04" => \&gst_service_debian_get_status,
|
|
376 |
+
|
|
377 |
+ "nexenta-1.0" => \&gst_service_smf_get_status,
|
|
378 |
+ "solaris-2.11" => \&gst_service_smf_get_status,
|
|
379 |
|
|
380 |
"redhat-5.2" => \&gst_service_redhat_get_status,
|
|
381 |
"redhat-6.0" => \&gst_service_redhat_get_status,
|
|
382 |
@@ -1909,6 +2124,7 @@
|
|
383 |
"rcng" => \&gst_service_rcng_run_script,
|
|
384 |
"suse" => \&gst_service_sysv_run_initd_script,
|
|
385 |
"archlinux" => \&gst_service_archlinux_run_script,
|
|
386 |
+ "smf" => \&gst_service_smf_run_svcadm,
|
|
387 |
);
|
|
388 |
|
|
389 |
$type = &gst_get_init_type ();
|
|
390 |
@@ -1964,6 +2180,14 @@
|
|
391 |
return 0;
|
|
392 |
}
|
|
393 |
|
|
394 |
+sub gst_service_smf_installed
|
|
395 |
+{
|
|
396 |
+ my ($service) = @_;
|
|
397 |
+
|
6962
|
398 |
+ return 1 if (! &gst_file_run("svcs -H -ostate $service"));
|
6955
|
399 |
+ return 0;
|
|
400 |
+}
|
|
401 |
+
|
|
402 |
sub gst_service_installed
|
|
403 |
{
|
|
404 |
my ($service) = @_;
|
|
405 |
@@ -1975,6 +2199,8 @@
|
|
406 |
return &gst_service_gentoo_installed ($service) if ($type eq "gentoo");
|
|
407 |
return &gst_service_rcng_installed ($service) if ($type eq "rcng");
|
|
408 |
return &gst_service_rcng_installed ($service) if ($type eq "archlinux");
|
|
409 |
+ return &gst_service_smf_installed ($service) if ($type eq "smf");
|
|
410 |
+
|
|
411 |
return 0;
|
|
412 |
}
|
|
413 |
|
|
414 |
@@ -2013,6 +2239,21 @@
|
|
415 |
}
|
|
416 |
}
|
|
417 |
|
|
418 |
+sub gst_service_smf_set_status
|
|
419 |
+{
|
|
420 |
+ my ($service, $active) = @_;
|
|
421 |
+ my (@arr);
|
|
422 |
+
|
|
423 |
+ if ($active)
|
|
424 |
+ {
|
|
425 |
+ &gst_file_run ("svcadm enable $service");
|
|
426 |
+ }
|
|
427 |
+ else
|
|
428 |
+ {
|
|
429 |
+ &gst_file_run ("svcadm disable $service");
|
|
430 |
+ }
|
|
431 |
+}
|
|
432 |
+
|
|
433 |
sub gst_service_gentoo_set_status
|
|
434 |
{
|
|
435 |
my ($script, $force_now, $active) = @_;
|
7035
|
436 |
diff -ru /usr/tmp/clean/system-tools-backends-1.4.2/debug.pl.in system-tools-backends-1.4.2/debug.pl.in
|
|
437 |
--- /usr/tmp/clean/system-tools-backends-1.4.2/debug.pl.in Sun Sep 14 22:51:49 2003
|
|
438 |
+++ system-tools-backends-1.4.2/debug.pl.in Mon Apr 10 16:04:52 2006
|
|
439 |
@@ -83,7 +83,14 @@
|
|
440 |
@buff = split ("\n", $doc);
|
|
441 |
foreach $line (@buff)
|
|
442 |
{
|
|
443 |
- print $fd "$line\n";
|
|
444 |
+ if ($line =~ /<password>/)
|
|
445 |
+ {
|
|
446 |
+ print $fd "# suppress line containing password\n";
|
|
447 |
+ }
|
|
448 |
+ else
|
|
449 |
+ {
|
|
450 |
+ print $fd "$line\n";
|
|
451 |
+ }
|
|
452 |
}
|
|
453 |
}
|
|
454 |
|