diff -ru /var/tmp/clean/system-tools-backends-1.4.2/file.pl.in system-tools-backends-1.4.2/file.pl.in
--- /var/tmp/clean/system-tools-backends-1.4.2/file.pl.in 2005-11-04 15:49:36.000000000 +0000
+++ system-tools-backends-1.4.2/file.pl.in 2006-03-13 10:14:56.141636000 +0000
@@ -772,6 +772,14 @@
}
}
+sub gst_file_read_joined_lines
+{
+ my ($file) = @_;
+ my $buffer = &gst_file_buffer_load ($file);
+ &gst_file_buffer_join_lines ($buffer);
+ $$buffer[0] =~ s/\n//; $$buffer[0] =~ s/\\//;
+ return $$buffer[0];
+}
# --- Command-line utilities --- #
diff -ru /var/tmp/clean/system-tools-backends-1.4.2/partition.pl.in system-tools-backends-1.4.2/partition.pl.in
--- /var/tmp/clean/system-tools-backends-1.4.2/partition.pl.in 2004-11-05 17:03:26.000000000 +0000
+++ system-tools-backends-1.4.2/partition.pl.in 2006-03-13 10:14:56.152216000 +0000
@@ -86,6 +86,17 @@
},
);
+sub gst_partition_scan_sunos_info
+{
+ my ($fd, $line);
+ my (%hash);
+ my (@table);
+
+ $hash{"partition"} = \@table;
+
+ return \%hash;
+}
+
sub gst_partition_scan_freebsd_info
{
my ($fd, $line);
@@ -192,6 +203,7 @@
return &gst_partition_scan_linux_info if ($plat eq "Linux");
return &gst_partition_scan_freebsd_info if ($plat eq "FreeBSD");
+ return &gst_partition_scan_sunos_info if ($plat eq "SunOS");
}
%GST_FILESYS_TYPES =
diff -ru /var/tmp/clean/system-tools-backends-1.4.2/platform.pl.in system-tools-backends-1.4.2/platform.pl.in
--- /var/tmp/clean/system-tools-backends-1.4.2/platform.pl.in 2006-01-02 15:32:34.000000000 +0000
+++ system-tools-backends-1.4.2/platform.pl.in 2006-03-13 10:14:56.152576000 +0000
@@ -38,6 +38,8 @@
$PLATFORM_INFO = {
+ "solaris-2.11" => "Solaris Nevada / Open Solaris",
+ "nexenta-1.0" => "Nexenta GNU/Solaris 1.0 Ellate",
"debian-2.2" => "Debian GNU/Linux 2.2 Potato",
"debian-3.0" => "Debian GNU/Linux 3.0 Woody",
"debian-sarge" => "Debian GNU/Linux Sarge",
@@ -110,7 +112,8 @@
("Debian" => "debian"),
("Mandrake" => "mandrake"),
("Conectiva" => "conectiva"),
- ("Blackpanther" => "blackpanther");
+ ("Blackpanther" => "blackpanther"),
+ ("gnu_solaris" => "nexenta");
# gst_prefix not required here: parse already does that for us.
$dist = lc (&gst_parse_sh ("/etc/lsb-release", "DISTRIB_ID"));
@@ -528,9 +531,11 @@
chomp ($dist = <$fd>);
&gst_file_close ($fd);
- if ($dist =~ /^5\.(\d)/) { return "solaris-2.$1" }
- else { if ($dist =~ /^([78])\.\d/) { return "solaris-$1.0" } }
- return -1;
+ if (-f "$gst_prefix/etc/debian_version") { return check_lsb() }
+ else {
+ if ($dist =~ /^5\.(\d+)/) { return "solaris-2.$1" }
+ else { return -1 }
+ }
}
sub gst_platform_get_system
diff -ru /var/tmp/clean/system-tools-backends-1.4.2/service.pl.in system-tools-backends-1.4.2/service.pl.in
--- /usr/tmp/clean/system-tools-backends-1.4.2/service.pl.in 2006-01-02 15:42:19.000000000 +0000
+++ system-tools-backends-1.4.2/service.pl.in 2006-04-18 10:49:44.023608000 +0100
@@ -85,6 +85,9 @@
"ubuntu-5.10" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
"ubuntu-6.04" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+ "nexenta-1.0" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+ "solaris-2.11" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+
"suse-7.0" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d", "../"],
"suse-9.0" => ["$gst_prefix/etc/init.d", "$gst_prefix/etc/init.d", "../"],
"suse-9.1" => ["$gst_prefix/etc/init.d", "$gst_prefix/etc/init.d", "../"],
@@ -154,6 +157,9 @@
"ubuntu-5.04" => [2, 3],
"ubuntu-5.10" => [2, 3],
"ubuntu-6.04" => [2, 3],
+
+ "nexenta-1.0" => [2, 3],
+ "solaris-2.11" => [2, 3],
"suse-7.0" => [3, 5],
"suse-9.0" => [3, 5],
@@ -223,6 +229,10 @@
"ubuntu-5.04" => "debian-2.2",
"ubuntu-5.10" => "debian-2.2",
"ubuntu-6.04" => "debian-2.2",
+
+ "nexenta-1.0" => "nexenta",
+
+ "solaris-2.11" => "solaris",
"suse-7.0" => "redhat-5.2",
"suse-9.0" => "redhat-5.2",
@@ -277,6 +287,14 @@
"default" => "GRAPHICAL",
"nonetwork" => "RECOVER"
},
+ "nexenta" => {"single-user" => "TEXT",
+ "multi-user" => "GRAPHICAL",
+ "none" => "RECOVER"
+ },
+ "solaris" => {"single-user" => "TEXT",
+ "multi-user" => "GRAPHICAL",
+ "none" => "RECOVER"
+ },
"freebsd-5" => {"rc" => "GRAPHICAL" },
"slackware-9.1.0" => {"4" => "GRAPHICAL" }
);
@@ -797,6 +815,154 @@
return \%ret;
}
+sub gst_service_smf_service_exist
+{
+ my($service) = @_;
+ my($services) = &gst_service_smf_get_services_list();
+
+ foreach $i (@$services)
+ {
+ return 1 if ($i =~ /$service/);
+ }
+
+ return 0;
+}
+
+sub gst_service_smf_run_svcadm
+{
+ my ($service, $arg) = @_;
+ my ($option);
+
+ my %map =
+ ("stop" => "stopped",
+ "start" => "started"
+ );
+
+ my %op =
+ ("stop" => "disable",
+ "start" => "enable"
+ );
+
+ &gst_report_enter ();
+
+ if (!exists $map{$arg})
+ {
+ &gst_report ("service_sysv_op_unk", $arg);
+ &gst_report_leave ();
+ return -1;
+ }
+
+ if (&gst_service_smf_service_exist ($service))
+ {
+ if (!&gst_file_run ("svcadm $op{$arg} $service"))
+ {
+ &gst_report ("service_sysv_op_success", $service, $str);
+ &gst_report_leave ();
+ return 0;
+ }
+ }
+
+ &gst_report ("service_sysv_op_failed", $service, $str);
+ &gst_report_leave ();
+ return -1;
+}
+
+sub gst_service_smf_runlevel_status_by_service
+{
+ my ($service, $status) = @_;
+ my (@arr, @ret);
+ my (@runlevels) = split(" ","single-user multi-user");
+
+ foreach $runlevel (@runlevels)
+ {
+ if ($status)
+ {
+ push @arr, { "name" => $runlevel,
+ "action" => "start" };
+ }
+ else
+ {
+ push @arr, { "name" => $runlevel,
+ "action" => "stop" };
+ }
+ }
+
+ push @ret, { "runlevel" => \@arr };
+ return @ret;
+}
+
+sub gst_service_smf_get_service_info
+{
+ my ($service) = @_;
+ my ($script, @actions, @runlevels);
+ my %hash;
+ my $role;
+ my $status = 0;
+ my $longname = "";
+
+ my $fd = &gst_file_run_pipe_read ("svcs -l $service");
+ while (<$fd>) {
+ $status = 1 if (/^state.*online/);
+ $longname = $1 if (/^name\s*(.*)/);
+ }
+ gst_file_close ($fd);
+
+ my($runlevels) = &gst_service_smf_runlevel_status_by_service ($service, $status);
+
+ $hash{"script"} = $service;
+ $hash{"longname"} = $longname if ($longname);
+ $hash{"runlevels"} = $runlevels unless ($runlevels eq undef);
+ $service =~ m/.*\/(.*)$/;
+ $role = &gst_service_get_role ($1);
+
+ if ($role eq "UNKNOWN") {
+ $role = "SYSTEM" if ($service =~ /^system\// || $service =~ /^platform\//);
+ $role = "NETWORK" if ($service =~ /^network\//);
+ $role = "NTP_SERVER" if ($service =~ /^network\/ntp/);
+ $role = "FILE_SERVER" if ($service =~ /^network\/nfs/);
+ $role = "DYNAMIC_DNS" if ($service =~ /^network\/dns/);
+ $role = "SYSTEM_LOGGER" if ($service =~ /^system\/system-log/);
+ $role = "MTA" if ($service =~ /^network\/smtp/);
+ $role = "PRINTER_SERVICE" if ($service =~ /^application\/print\/server/);
+ }
+
+ $hash{"role"} = $role;
+
+ return \%hash;
+}
+
+sub gst_service_smf_get_services_list
+{
+ my @list;
+ local *SVCS=gst_file_run_pipe_read("svcs -H -a");
+ while (<SVCS>) {
+ next if (/svc:\/milestone/);
+ if (/^.*\s*.*\s*svc:\/(.*):.*/) {
+ push(@list,$1);
+ }
+ }
+ close (SVCS);
+
+ return \@list;
+}
+
+sub gst_service_smf_get_services
+{
+ my ($service);
+ my (%ret);
+ my ($service_list) = &gst_service_smf_get_services_list ();
+
+ foreach $service (@$service_list)
+ {
+ my (%hash);
+ $hash = &gst_service_smf_get_service_info ($service);
+
+ $ret{$service} = $hash if ($hash ne undef);
+ }
+
+ return \%ret;
+}
+
# these functions get a list of the services that run on a gentoo init
sub gst_service_gentoo_get_service_status
{
@@ -1163,6 +1329,10 @@
{
return "suse";
}
+ elsif ($gst_dist =~ /nexenta/ || $gst_dist =~ /solaris-2.11/)
+ {
+ return "smf";
+ }
else
{
return "sysv";
@@ -1180,6 +1350,8 @@
return &gst_service_rcng_get_services () if ($type eq "rcng");
return &gst_service_suse_get_services () if ($type eq "suse");
return &gst_service_archlinux_get_services() if ($type eq "archlinux");
+ return &gst_service_smf_get_services () if ($type eq "smf");
+
return undef;
}
@@ -1199,7 +1371,7 @@
{
my ($type) = &gst_get_init_type ();
- return "default" if ($type eq "gentoo");
+ return "default" if ($type eq "gentoo" || $type eq "smf");
return "rc" if ($type eq "rcng");
return "rc" if ($type eq "archlinux");
return &gst_service_sysv_get_default_runlevel ();
@@ -1585,6 +1757,7 @@
&gst_service_rcng_set_services ($services, $runlevel) if ($type eq "rcng");
&gst_service_suse_set_services ($services, $runlevel) if ($type eq "suse");
&gst_service_archlinux_set_services ($services, $runlevel) if ($type eq "archlinux");
+ &gst_service_smf_set_services ($services, $runlevel) if ($type eq "smf");
}
sub gst_service_set_conf
@@ -1632,6 +1805,47 @@
return undef;
}
+sub gst_service_smf_set_services
+{
+ my ($services, $runlevel) = @_;
+ my ($action);
+
+ foreach $service (@$services)
+ {
+ $script = $$service{"script"};
+ $arr = $$service{"runlevels"}[0]{"runlevel"};
+
+ foreach $i (@$arr)
+ {
+ $action = $$i{"action"};
+ $rl = $$i{"name"};
+
+ if ( $action eq "start")
+ {
+ &gst_file_run ("rc-update add $script $rl");
+ }
+ elsif ($action eq "stop")
+ {
+ &gst_file_run ("rc-update del $script $rl");
+ }
+ }
+ }
+}
+
+sub gst_service_smf_get_status
+{
+ my ($service) = @_;
+ my $ret = 0;
+ my $fd = &gst_file_run_pipe_read ("svcs -H -ostate $service");
+
+ while (<$fd>) {
+ if (/^online/) { $ret = 1; last; }
+ }
+ gst_file_close ($fd);
+
+ return $ret;
+}
+
sub gst_service_redhat_get_status
{
my ($service) = @_;
@@ -1697,6 +1911,9 @@
"ubuntu-5.04" => \&gst_service_debian_get_status,
"ubuntu-5.10" => \&gst_service_debian_get_status,
"ubuntu-6.04" => \&gst_service_debian_get_status,
+
+ "nexenta-1.0" => \&gst_service_smf_get_status,
+ "solaris-2.11" => \&gst_service_smf_get_status,
"redhat-5.2" => \&gst_service_redhat_get_status,
"redhat-6.0" => \&gst_service_redhat_get_status,
@@ -1909,6 +2126,7 @@
"rcng" => \&gst_service_rcng_run_script,
"suse" => \&gst_service_sysv_run_initd_script,
"archlinux" => \&gst_service_archlinux_run_script,
+ "smf" => \&gst_service_smf_run_svcadm,
);
$type = &gst_get_init_type ();
@@ -1964,6 +2182,14 @@
return 0;
}
+sub gst_service_smf_installed
+{
+ my ($service) = @_;
+
+ return 1 if (! &gst_file_run("svcs -H -ostate $service"));
+ return 0;
+}
+
sub gst_service_installed
{
my ($service) = @_;
@@ -1975,6 +2201,8 @@
return &gst_service_gentoo_installed ($service) if ($type eq "gentoo");
return &gst_service_rcng_installed ($service) if ($type eq "rcng");
return &gst_service_rcng_installed ($service) if ($type eq "archlinux");
+ return &gst_service_smf_installed ($service) if ($type eq "smf");
+
return 0;
}
@@ -2013,6 +2241,21 @@
}
}
+sub gst_service_smf_set_status
+{
+ my ($service, $active) = @_;
+ my (@arr);
+
+ if ($active)
+ {
+ &gst_file_run ("svcadm enable $service");
+ }
+ else
+ {
+ &gst_file_run ("svcadm disable $service");
+ }
+}
+
sub gst_service_gentoo_set_status
{
my ($script, $force_now, $active) = @_;
diff -ru /usr/tmp/clean/system-tools-backends-1.4.2/debug.pl.in system-tools-backends-1.4.2/debug.pl.in
--- /usr/tmp/clean/system-tools-backends-1.4.2/debug.pl.in Sun Sep 14 22:51:49 2003
+++ system-tools-backends-1.4.2/debug.pl.in Mon Apr 10 16:04:52 2006
@@ -83,7 +83,14 @@
@buff = split ("\n", $doc);
foreach $line (@buff)
{
- print $fd "$line\n";
+ if ($line =~ /<password>/)
+ {
+ print $fd "# suppress line containing password\n";
+ }
+ else
+ {
+ print $fd "$line\n";
+ }
}
}
diff -ru /usr/tmp/clean/system-tools-backends-1.4.2/share.pl.in system-tools-backends-1.4.2/share.pl.in
--- /usr/tmp/clean/system-tools-backends-1.4.2/share.pl.in 2005-02-25 14:15:34.000000000 +0000
+++ system-tools-backends-1.4.2/share.pl.in 2006-04-19 14:17:15.392791000 +0100
@@ -202,6 +202,16 @@
}
}
+sub gst_share_nfs_info_get_name
+{
+ return $_[0]->{'name'};
+}
+
+sub gst_share_nfs_info_set_name
+{
+ &gst_share_nfs_info_set ($_[0], 'name', $_[1]);
+}
+
sub gst_share_nfs_info_get_point
{
return $_[0]->{'point'};
@@ -397,6 +407,52 @@
return $table;
}
+sub gst_share_dfstab_list
+{
+ my ($file) = @_;
+ my $lnum = 0;
+ my @rv;
+
+ # dfstab example:
+ #
+ # share [-F fstype] [-o fs_options ] [-d description] [pathname [resourcename]]
+ # .e.g,
+ # share -F nfs -o rw=engineering -d "home dirs" /export/home2
+ my $fd = &gst_file_open_read_from_names ($file);
+ return @rv if !$fd;
+
+ while (<$fd>) {
+ s/\r|\n//g; s/#.*$//;
+ if (/^\s*\S*share\s+(.*)/) {
+ # Found a share line
+ my $share = { 'line' => $lnum,
+ 'index' => scalar(@rv) };
+ my $line = $1;
+ while($line =~ /\\$/) {
+ $_ = <$fd>;
+ s/\r|\n//g; s/#.*$//;
+ $line =~ s/\\$//;
+ $line .= $_;
+ $lnum++;
+ }
+ $share->{'eline'} = $lnum;
+ if ($line =~ /\s+(\/\S+)/ || $line =~ /\s+(\/)/ || $line eq "/") { $share->{'dir'} = $1; }
+ if ($line =~ /-d\s+"([^"]+)"/) { $share->{'desc'} = $1; }
+ elsif ($line =~ /-d\s+(\S+)/) { $share->{'desc'} = $1; }
+ if ($line =~ /-o\s+"([^"]+)"/) { $share->{'opts'} = $1; }
+ elsif ($line =~ /-o\s+(\S+)/) { $share->{'opts'} = $1; }
+ if ($line =~ /\s-F\s+(\S+)/) { $share->{'type'} = $1; }
+ else { $share->{'type'} = "nfs"; }
+ $share->{'desc'} =~ s/"//g; $share->{'desc'} =~ s/'//g;
+ push(@rv, $share);
+ }
+ $lnum++;
+ }
+ &gst_file_close ($fd);
+
+ return @rv;
+}
+
sub gst_share_parse_nfs_exports
{
my ($nfs_exports_name) = @_;
@@ -405,43 +461,82 @@
$table = &gst_share_nfs_table_new ();
- $entries = &gst_parse_split_hash_with_continuation ($nfs_exports_name, "[ \t]+", "[ \t]+");
+ if ($$tool{"system"} eq "SunOS") {
+ foreach $share (&gst_share_dfstab_list($nfs_exports_name)) {
+ if ($share->{'type'} eq "nfs") {
+ my $info = &gst_share_nfs_info_new ();
+ my $client_table = &gst_share_nfs_client_table_new ();
+
+ &gst_share_nfs_info_set_point ($info, $share->{'dir'});
+ &gst_share_nfs_info_set_name ($info, $share->{'desc'});
+
+ # Parse a mount options string like rw=foo,nosuid,...
+ # Parts with no value are given an empty string as the value
+ foreach my $opt (split(/,/, $share->{'opts'})) {
+ if ($opt =~ /^([^=]+)=(.*)$/) {
+ my $cinfo = &gst_share_nfs_client_info_new ();
+ my $pattern;
+ my $access = $1;
+ my $client = $2;
+
+ $client =~ /^([a-zA-Z0-9.-_*?@\/]+)/;
+ $pattern = $1;
+ $pattern = "0.0.0.0/0" if $pattern eq "";
+ &gst_share_nfs_client_info_set_pattern ($cinfo, $pattern);
+
+ if ($access eq "rw" || $access eq "root") {
+ &gst_share_nfs_client_info_set_write ($cinfo, 1);
+ }
+
+ &gst_share_nfs_client_table_add ($client_table, $cinfo);
+ } else {
+ $clients{$opt} = "";
+ }
+ }
- foreach $point (keys %$entries)
- {
- my $clients = $$entries{$point};
- my $info = &gst_share_nfs_info_new ();
- my $client_table = &gst_share_nfs_client_table_new ();
-
- &gst_share_nfs_info_set_point ($info, $point);
-
- foreach $client (@$clients)
+ &gst_share_nfs_info_set_client_table ($info, $client_table);
+ &gst_share_nfs_table_add ($table, $info);
+ }
+ }
+ } else {
+ $entries = &gst_parse_split_hash_with_continuation ($nfs_exports_name, "[ \t]+", "[ \t]+");
+
+ foreach $point (keys %$entries)
{
- my $cinfo = &gst_share_nfs_client_info_new ();
- my $pattern;
-
- $client =~ /^([a-zA-Z0-9.-_*?@\/]+)/;
- $pattern = $1;
- $pattern = "0.0.0.0/0" if $pattern eq "";
- &gst_share_nfs_client_info_set_pattern ($cinfo, $pattern);
-
- my $option_str = "";
- my @options;
-
- if ($client =~ /\((.+)\)/) { $option_str = $1; }
- @options = ($option_str =~ /([a-zA-Z0-9_=-]+),?/mg);
-
- for $option (@options)
+ my $clients = $$entries{$point};
+ my $info = &gst_share_nfs_info_new ();
+ my $client_table = &gst_share_nfs_client_table_new ();
+
+ &gst_share_nfs_info_set_point ($info, $point);
+
+ foreach $client (@$clients)
{
- if ($option eq "rw") { &gst_share_nfs_client_info_set_write ($cinfo, 1); }
- # Add supported NFS export options here. Some might have to be split on '='.
+ my $cinfo = &gst_share_nfs_client_info_new ();
+ my $pattern;
+
+ $client =~ /^([a-zA-Z0-9.-_*?@\/]+)/;
+ $pattern = $1;
+ $pattern = "0.0.0.0/0" if $pattern eq "";
+ &gst_share_nfs_client_info_set_pattern ($cinfo, $pattern);
+
+ my $option_str = "";
+ my @options;
+
+ if ($client =~ /\((.+)\)/) { $option_str = $1; }
+ @options = ($option_str =~ /([a-zA-Z0-9_=-]+),?/mg);
+
+ for $option (@options)
+ {
+ if ($option eq "rw") { &gst_share_nfs_client_info_set_write ($cinfo, 1); }
+ # Add supported NFS export options here. Some might have to be split on '='.
+ }
+
+ &gst_share_nfs_client_table_add ($client_table, $cinfo);
}
-
- &gst_share_nfs_client_table_add ($client_table, $cinfo);
+
+ &gst_share_nfs_info_set_client_table ($info, $client_table);
+ &gst_share_nfs_table_add ($table, $info);
}
-
- &gst_share_nfs_info_set_client_table ($info, $client_table);
- &gst_share_nfs_table_add ($table, $info);
}
return $table;
@@ -495,11 +590,27 @@
{
# Each line is in the following format:
# <point> <clients>
- my @line = split /[ \t]+/, $_;
- if ($line[0] eq "") { shift @line; }
- if (@line < 1 || &gst_ignore_line (@line)) { print $outfd $_; next; }
-
- return $_;
+ if ($$tool{"system"} eq "SunOS") {
+ if (&gst_ignore_line($_)) { print $outfd $_; next; }
+ if (/^\s*\S*share\s+(.*)/) {
+ my $point, $type;
+ my $line = $1;
+ while($line =~ /\\$/) {
+ $_ = <$infd>;
+ s/\r|\n//g; s/#.*$//;
+ $line =~ s/\\$//;
+ $line .= $_;
+ }
+ if ($line =~ /\s-F\s+(\S+)/) { $type = $1; }
+ else { $type = "nfs"; }
+ return "share $line\n" if ($type eq "nfs");
+ }
+ } else {
+ my @line = split /[ \t]+/, $_;
+ if ($line[0] eq "") { shift @line; }
+ if (@line < 1 || &gst_ignore_line (@line)) { print $outfd $_; next; }
+ return $_;
+ }
}
return undef;
@@ -528,9 +639,20 @@
for $client (@$clients)
{
- $line .= &gst_share_nfs_client_info_get_pattern ($client);
- $line .= "(rw)" if (&gst_share_nfs_client_info_get_write ($client));
- $line .= " ";
+ if ($$tool{"system"} eq "SunOS") {
+ if (&gst_share_nfs_client_info_get_pattern ($client) ne "") {
+ $line .= "," if ($notfirst);
+ if (&gst_share_nfs_client_info_get_write ($client)) { $line .= "rw=";
+ }
+ else { $line .= "ro="; }
+ $line .= &gst_share_nfs_client_info_get_pattern ($client);
+ }
+ $notfirst = 0;
+ } else {
+ $line .= &gst_share_nfs_client_info_get_pattern ($client);
+ $line .= "(rw)" if (&gst_share_nfs_client_info_get_write ($client));
+ $line .= " ";
+ }
}
return $line;
@@ -541,13 +663,19 @@
my ($info) = @_;
my $line;
- # <point>
-
- $line = sprintf ("%-15s ", &gst_share_nfs_info_get_point ($info));
-
- # <clients>
-
- $line .= &gst_share_nfs_info_print_clients ($info);
+ if ($$tool{"system"} eq "SunOS") {
+ $line = "share -F nfs ";
+ $line .= sprintf ("-o %s ", &gst_share_nfs_info_print_clients ($info))
+ if (&gst_share_nfs_info_print_clients ($info));
+ $line .= sprintf ("-d %s ", &gst_share_nfs_info_get_name ($info))
+ if (&gst_share_nfs_info_get_name ($info));
+ $line .= sprintf ("%-15s ", &gst_share_nfs_info_get_point ($info));
+ } else {
+ # <point>
+ $line = sprintf ("%-15s ", &gst_share_nfs_info_get_point ($info));
+ # <clients>
+ $line .= &gst_share_nfs_info_print_clients ($info);
+ }
return $line;
}
@@ -583,66 +711,75 @@
my $outline;
my $ctable = &gst_share_nfs_info_get_client_table ($info);
- # <point>
-
- $outline = sprintf ("%-15s", &gst_share_nfs_info_get_point ($info));
-
- # <clients>
-
- chomp $line;
- my @clients = split /[ \t]+/, $line;
- shift @clients;
-
- # Make client hash based on line.
-
- my $chash = { };
-
- for $client (@clients)
- {
- my $opthash = { };
-
- $client =~ /^([a-zA-Z0-9.-_*?@\/]+)/;
- my $pattern = $1;
- $$chash{$pattern} = $opthash;
-
- my $option_str = "";
- if ($client =~ /\((.+)\)/) { $option_str = $1; }
- @options = ($option_str =~ /([a-zA-Z0-9_=-]+),?/mg);
-
- for $option (@options)
- {
- my ($key, $value) = split /[=]/, $option;
- next if ($key eq "");
-
- if ($value eq "" && $option =~ /=/) { $value = " "; }
- $$opthash{$key} = $value;
- }
- }
-
- # @clients contains client(options) entries.
-
- for $cinfo (@$ctable)
- {
- my $pattern = &gst_share_nfs_client_info_get_pattern ($cinfo);
- my $opthash = $$chash{$pattern};
-
- if (&gst_share_nfs_client_info_get_write ($cinfo))
- {
- $$opthash{'rw'} = "";
- }
- else
+ if ($$tool{"system"} eq "SunOS") {
+ my $desc = "unknown";
+ if ($line =~ /-d\s+"([^"]+)"/) { $desc = $1; }
+ elsif ($line =~ /-d\s+(\S+)/) { $desc = $1; }
+ $desc =~ s/"//g; $desc =~ s/'//g;
+ &gst_share_nfs_info_set_name ($info, $desc);
+ $outline = &gst_share_nfs_info_print_entry ($info);
+ } else {
+ # <point>
+
+ $outline = sprintf ("%-15s", &gst_share_nfs_info_get_point ($info));
+
+ # <clients>
+
+ chomp $line;
+ my @clients = split /[ \t]+/, $line;
+ shift @clients;
+
+ # Make client hash based on line.
+
+ my $chash = { };
+
+ for $client (@clients)
{
- delete $$opthash{'rw'};
+ my $opthash = { };
+
+ $client =~ /^([a-zA-Z0-9.-_*?@\/]+)/;
+ my $pattern = $1;
+ $$chash{$pattern} = $opthash;
+
+ my $option_str = "";
+ if ($client =~ /\((.+)\)/) { $option_str = $1; }
+ @options = ($option_str =~ /([a-zA-Z0-9_=-]+),?/mg);
+
+ for $option (@options)
+ {
+ my ($key, $value) = split /[=]/, $option;
+ next if ($key eq "");
+
+ if ($value eq "" && $option =~ /=/) { $value = " "; }
+ $$opthash{$key} = $value;
+ }
}
-
- $outline .= " " . &gst_share_nfs_client_info_get_pattern ($cinfo);
- my $client_string = &gst_share_nfs_client_print_option_hash ($opthash);
- if ($client_string ne "")
+
+ # @clients contains client(options) entries.
+
+ for $cinfo (@$ctable)
{
- $outline .= "(" . $client_string . ")";
+ my $pattern = &gst_share_nfs_client_info_get_pattern ($cinfo);
+ my $opthash = $$chash{$pattern};
+
+ if (&gst_share_nfs_client_info_get_write ($cinfo))
+ {
+ $$opthash{'rw'} = "";
+ }
+ else
+ {
+ delete $$opthash{'rw'};
+ }
+
+ $outline .= " " . &gst_share_nfs_client_info_get_pattern ($cinfo);
+ my $client_string = &gst_share_nfs_client_print_option_hash ($opthash);
+ if ($client_string ne "")
+ {
+ $outline .= "(" . $client_string . ")";
+ }
}
}
-
+
return $outline;
}
@@ -719,7 +856,11 @@
my ($line) = @_;
my $point;
- ($point) = split /[ \t]+/, $line;
+ if ($$tool{"system"} eq "SunOS") {
+ if ($line =~ /\s+(\/\S+)/ || $line =~ /\s+(\/)/ || $line eq "/") { $point = $1; }
+ } else {
+ ($point) = split /[ \t]+/, $line;
+ }
return $point;
}
@@ -752,6 +893,12 @@
&gst_share_nfs_exports_remove_entry ($file, $old_info);
}
}
+
+ if ($$tool{"system"} eq "SunOS") {
+ &gst_file_run ("svcadm enable nfs/server");
+ &gst_file_run ("unshareall");
+ &gst_file_run ("/bin/sh $file");
+ }
}