author | padraigo |
Thu, 16 Mar 2006 09:25:39 +0000 | |
changeset 6955 | fef846f62545 |
parent 6954 | 7e30424de441 |
child 6956 | 713bbe1b3bbd |
--- a/ChangeLog Thu Mar 16 09:13:32 2006 +0000 +++ b/ChangeLog Thu Mar 16 09:25:39 2006 +0000 @@ -1,3 +1,22 @@ +2006-03-16 Padraig O'Briain <[email protected]> + + * patches/gnome-system-tools-01-config.diff + * patches/gnome-system-tools-02-forkpty.diff + * patches/gnome-system-tools-03-emptyconstruct.diff + * patches/gnome-system-tools-04-tz.diff + * patches/gnome-system-tools-05-shares.diff + * patches/system-tools-backends-01-boot.diff + * patches/system-tools-backends-02-common.diff + * patches/system-tools-backends-03-disks.diff + * patches/system-tools-backends-04-network.diff + * patches/system-tools-backends-05-services.diff + * patches/system-tools-backends-06-shares.diff + * patches/system-tools-backends-07-time.diff + * patches/system-tools-backends-08-users.diff: Patches moved from + Solaris directory + * gnome-system-tools.spec: + * system-tools-backends.spec: Update to apply patches. + 2006-03-15 Damien Carbery <[email protected]> * libbonoboui.spec: Bump to 2.14.0.
--- a/gnome-system-tools.spec Thu Mar 16 09:13:32 2006 +0000 +++ b/gnome-system-tools.spec Thu Mar 16 09:25:39 2006 +0000 @@ -15,6 +15,11 @@ Vendor: Sun Microsystems, Inc. Summary: GNOME System Tools Source: http://ftp.gnome.org/pub/GNOME/sources/%{name}/2.14/%{name}-%{version}.tar.bz2 +Patch1: gnome-system-tools-01-config.diff +Patch2: gnome-system-tools-02-forkpty.diff +Patch3: gnome-system-tools-03-emptystruct.diff +Patch4: gnome-system-tools-04-tz.diff +Patch5: gnome-system-tools-05-shares.diff URL: http://www.gnome.org BuildRoot: %{_tmppath}/%{name}-%{version}-build Docdir: %{_defaultdocdir}/%{name} @@ -60,6 +65,11 @@ %prep %setup -q +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 %build @@ -114,6 +124,9 @@ %{_sysconfdir}/gconf/schemas/* %changelog +* Thu Mar 16 2006 - [email protected] +- Move patches here from Solaris package spec file. + * Tue Mar 14 2006 - [email protected] - Bump to 2.14.0.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/gnome-system-tools-01-config.diff Thu Mar 16 09:25:39 2006 +0000 @@ -0,0 +1,20 @@ +--- gnome-system-tools-2.13.2/configure.orig Fri Mar 3 16:02:31 2006 ++++ gnome-system-tools-2.13.2/configure Fri Mar 3 16:03:51 2006 +@@ -22609,7 +22609,7 @@ + else + { { echo "$as_me:$LINENO: error: Libutil library ir required." >&5 + echo "$as_me: error: Libutil library ir required." >&2;} +- { (exit 1); exit 1; }; } ++ } + fi + + if test "${ac_cv_header_pty_h+set}" = set; then +@@ -25067,7 +25067,7 @@ + GST_LIBS="$GST_DEPENDS_LIBS" + GST_CFLAGS="$GST_DEPENDS_CFLAGS $GST_CRACK_LIB_CFLAGS $GST_DEPRECATED_FLAGS" + +-GST_TOOL_LIBS="$GST_LIBS -lutil \$(top_builddir)/src/common/libsetuptool.a" ++GST_TOOL_LIBS="$GST_LIBS \$(top_builddir)/src/common/libsetuptool.a" + GST_TOOL_CFLAGS="$GST_CFLAGS -I\$(top_srcdir)/src/common" + + GST_TOOL_CLEANFILES="\$(desktop) \$(desktop).in"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/gnome-system-tools-02-forkpty.diff Thu Mar 16 09:25:39 2006 +0000 @@ -0,0 +1,107 @@ +--- gnome-system-tools-2.13.2/src/common/gst-auth.c-orig Tue Jan 31 12:56:32 2006 ++++ gnome-system-tools-2.13.2/src/common/gst-auth.c Fri Mar 3 15:35:26 2006 +@@ -43,6 +43,13 @@ + #ifdef __FreeBSD__ + # include <errno.h> + # include <libutil.h> ++#elif defined(__sun) ++#include <fcntl.h> ++#include <unistd.h> ++#include <stdlib.h> ++#include <sys/ioctl.h> ++#include <sys/stream.h> ++#include <sys/stropts.h> + #else + #include <pty.h> + #endif +@@ -118,6 +125,90 @@ + return TRUE; + } + ++#ifdef __sun ++ ++/* fork_pty() remplacement for Solaris. ++ * This ignore the last two arguments ++ * for the moment ++ */ ++int forkpty (int *amaster, char *name, void *unused1, void *unused2) ++{ ++ int master, slave, fd; ++ char *slave_name; ++ pid_t pid; ++ void (*sig_saved)(int); ++ ++ master = open("/dev/ptmx", O_RDWR | O_NOCTTY); ++ if (master < 0) ++ return -1; ++ ++ sig_saved = signal (SIGCHLD, SIG_DFL); ++ if (grantpt (master) < 0) ++ { ++ signal (SIGCHLD, sig_saved); ++ close (master); ++ return -1; ++ } ++ ++ if (unlockpt (master) < 0) ++ { ++ signal (SIGCHLD, sig_saved); ++ close (master); ++ return -1; ++ } ++ signal (SIGCHLD, sig_saved); ++ ++ slave_name = ptsname (master); ++ if (slave_name == NULL) ++ { ++ close (master); ++ return -1; ++ } ++ ++ slave = open (slave_name, O_RDWR | O_NOCTTY); ++ if (slave < 0) ++ { ++ close (master); ++ return -1; ++ } ++ ++ if (ioctl (slave, I_PUSH, "ptem") < 0 ++ || ioctl (slave, I_PUSH, "ldterm") < 0 ++ || ioctl (slave, I_PUSH, "ttcompat") < 0) ++ { ++ close (slave); ++ close (master); ++ return -1; ++ } ++ ++ if (amaster) ++ *amaster = master; ++ ++ if (name) ++ strcpy (name, slave_name); ++ ++ pid = fork (); ++ switch (pid) ++ { ++ case -1: /* Error */ ++ return -1; ++ case 0: /* Child */ ++ if (setsid() < 0) ++ return -1; ++ close (master); ++ dup2 (slave, STDIN_FILENO); ++ dup2 (slave, STDOUT_FILENO); ++ dup2 (slave, STDERR_FILENO); ++ return 0; ++ default: /* Parent */ ++ close (slave); ++ return pid; ++ } ++ ++ return -1; ++} ++#endif ++ + /* runs a term with su in it */ + static void + gst_auth_run_term (GstTool *tool, gchar *args[])
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/gnome-system-tools-03-emptystruct.diff Thu Mar 16 09:25:39 2006 +0000 @@ -0,0 +1,12 @@ +--- gnome-system-tools-2.13.2/src/network/network-iface-irlan.c-orig 2006-03-03 15:53:13.412221000 +0000 ++++ gnome-system-tools-2.13.2/src/network/network-iface-irlan.c 2006-03-03 15:54:17.203738000 +0000 +@@ -25,6 +25,9 @@ + #include "gst.h" + + struct _GstIfaceIrlanPriv { ++#ifdef sun ++ int __dummy; ++#endif + }; + + static void gst_iface_irlan_class_init (GstIfaceIrlanClass *class);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/gnome-system-tools-04-tz.diff Thu Mar 16 09:25:39 2006 +0000 @@ -0,0 +1,50 @@ +--- gnome-system-tools-2.13.2/src/time/tz.c-orig 2006-03-03 16:10:56.472348000 +0000 ++++ gnome-system-tools-2.13.2/src/time/tz.c 2006-03-03 16:12:46.542427000 +0000 +@@ -90,7 +90,25 @@ + loc->comment = (tmpstrarr[3]) ? g_strdup(tmpstrarr[3]) : NULL; + loc->latitude = convert_pos (latstr, 2); + loc->longitude = convert_pos (lngstr, 3); +- ++ if (tmpstrarr[3] && *tmpstrarr[3] == '-' && tmpstrarr[4]) ++ loc->comment = g_strdup(tmpstrarr[4]); ++ else if (tmpstrarr[3] && *tmpstrarr[3] != '-' && !islower(loc->zone)) { ++ TzLocation *locgrp; ++ /* duplicate entry */ ++ locgrp = g_new (TzLocation, 1); ++ locgrp->country = g_strdup (tmpstrarr[0]); ++ locgrp->zone = g_strdup (tmpstrarr[3]); ++ locgrp->latitude = convert_pos (latstr, 2); ++ locgrp->longitude = convert_pos (lngstr, 3); ++ if (tmpstrarr[4]) { ++ loc->comment = g_strdup(tmpstrarr[4]); ++ locgrp->comment = g_strdup(tmpstrarr[4]); ++ } else { ++ loc->comment = locgrp->comment = NULL; ++ } ++ g_ptr_array_add (tz_db->locations, (gpointer) locgrp); ++ } else ++ loc->comment = NULL; + g_ptr_array_add (tz_db->locations, (gpointer) loc); + + g_free (latstr); +@@ -213,6 +231,7 @@ + curtime = time (NULL); + curzone = localtime (&curtime); + ++#ifndef __sun + /* Currently this solution doesnt seem to work - I get that */ + /* America/Phoenix uses daylight savings, which is wrong */ + tzinfo->tzname_normal = g_strdup (curzone->tm_zone); +@@ -223,6 +242,12 @@ + tzinfo->tzname_daylight = NULL; + + tzinfo->utc_offset = curzone->tm_gmtoff; ++#else ++ tzinfo->tzname_normal = NULL; ++ tzinfo->tzname_daylight = NULL; ++ tzinfo->utc_offset = 0; ++#endif ++ + tzinfo->daylight = curzone->tm_isdst; + + return tzinfo;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/gnome-system-tools-05-shares.diff Thu Mar 16 09:25:39 2006 +0000 @@ -0,0 +1,9 @@ +--- gnome-system-tools-2.13.2/src/shares/share-export.c-orig 2006-03-03 16:16:05.157378000 +0000 ++++ gnome-system-tools-2.13.2/src/shares/share-export.c 2006-03-03 16:16:26.132960000 +0000 +@@ -181,5 +181,5 @@ + if (GST_SHARE_GET_CLASS (share)->get_xml == NULL) + return; + +- return GST_SHARE_GET_CLASS (share)->get_xml (share, parent); ++ GST_SHARE_GET_CLASS (share)->get_xml (share, parent); + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/system-tools-backends-01-boot.diff Thu Mar 16 09:25:39 2006 +0000 @@ -0,0 +1,96 @@ +diff -ru /var/tmp/clean/system-tools-backends-1.4.2/boot-conf.in system-tools-backends-1.4.2/boot-conf.in +--- /var/tmp/clean/system-tools-backends-1.4.2/boot-conf.in 2004-08-02 22:02:53.000000000 +0100 ++++ system-tools-backends-1.4.2/boot-conf.in 2006-03-13 10:14:56.088698000 +0000 +@@ -241,6 +241,7 @@ + ( + "lilo" => \&gst_boot_lilo_verify, + "grub" => \&gst_boot_grub_verify, ++ "sungrub" => \&gst_boot_grub_verify, + "yaboot" => \&gst_boot_yaboot_verify + ); + +diff -ru /var/tmp/clean/system-tools-backends-1.4.2/boot.pl.in system-tools-backends-1.4.2/boot.pl.in +--- /var/tmp/clean/system-tools-backends-1.4.2/boot.pl.in 2004-08-30 01:41:30.000000000 +0100 ++++ system-tools-backends-1.4.2/boot.pl.in 2006-03-13 10:14:56.089804000 +0000 +@@ -156,6 +156,11 @@ + "exec" => "lilo" }; + } + ++ if (gst_file_locate_tool ("installgrub") && -e "/boot/grub/bin/grub") { ++ push @list, { "name" => "SunGrub", ++ "exec" => "/boot/grub/bin/grub" }; ++ } ++ + if (gst_file_locate_tool ("grub-install")) + { + push @list, { "name" => "Grub", +@@ -197,6 +202,17 @@ + $current_tool = "grub"; + } + } ++ ++ $bootl = gst_file_locate_tool ("installgrub"); ++ if ($bootl ne "") ++ { ++ $date = (stat ($bootl)) [8]; ++ if ($date > $current_date) ++ { ++ $current_date = $date; ++ $current_tool = "sungrub"; ++ } ++ } + + $bootl = gst_file_locate_tool ("ybin"); + if ($bootl ne "") +@@ -311,6 +327,26 @@ + ] + }, + ++ "sungrub" => ++ { ++ fn => ++ { ++ GRUB_CONF => $config_file, ++# DEVICE_MAP => "/boot/grub/device.map", ++# MTAB => "/etc/mnttab" ++ }, ++ table => ++ [ ++ [ "partitions", \&gst_partition_scan_info ], ++# [ "pixmapsup", \&gst_parse_trivial, 1 ], ++# [ "pixmap", \&gst_boot_grub_parse_pixmap, [GRUB_CONF, DEVICE_MAP, MTAB] ], ++ [ "timeout", \&gst_boot_grub_parse_timeout, GRUB_CONF ], ++ [ "prompt", \&gst_boot_grub_parse_prompt, GRUB_CONF ], ++ [ "default", \&gst_boot_grub_parse_default, GRUB_CONF ], ++ [ "entry", \&gst_boot_entries_get, "%partitions%" ], ++ ] ++ }, ++ + "yaboot" => + { + fn => +@@ -457,6 +493,24 @@ + [ "entry", \&gst_boot_grub_entries_set, [GRUB_CONF, DEVICE_MAP, MTAB] ], + ] + }, ++ ++ "sungrub" => ++ { ++ fn => ++ { ++ GRUB_CONF => $config_file, ++# DEVICE_MAP => "/boot/grub/device.map", ++# MTAB => "/etc/mnttab" ++ }, ++ table => ++ [ ++# [ "pixmap", \&gst_boot_grub_replace_pixmap, [GRUB_CONF, DEVICE_MAP, MTAB] ], ++ [ "timeout", \&gst_boot_grub_replace_timeout, GRUB_CONF ], ++ [ "prompt", \&gst_boot_grub_replace_prompt, GRUB_CONF ], ++ [ "default", \&gst_boot_grub_replace_default, GRUB_CONF , "%entry%"], ++# [ "entry", \&gst_boot_grub_entries_set, [GRUB_CONF, DEVICE_MAP, MTAB] ], ++ ] ++ }, + + "yaboot" => + {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/system-tools-backends-02-common.diff Thu Mar 16 09:25:39 2006 +0000 @@ -0,0 +1,435 @@ +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 +--- /var/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-03-13 10:14:56.155005000 +0000 +@@ -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,152 @@ + 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/); ++ } ++ ++ $hash{"role"} = $role; ++ ++ return \%hash; ++} ++ ++sub gst_service_smf_get_services_list ++{ ++ my @list; ++ local *SVCS=gst_file_run_pipe_read("svcs -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 +1327,10 @@ + { + return "suse"; + } ++ elsif ($gst_dist =~ /nexenta/ || $gst_dist =~ /solaris-2.11/) ++ { ++ return "smf"; ++ } + else + { + return "sysv"; +@@ -1180,6 +1348,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 +1369,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 +1755,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 +1803,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 -a -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 +1909,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 +2124,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 +2180,14 @@ + return 0; + } + ++sub gst_service_smf_installed ++{ ++ my ($service) = @_; ++ ++ return 1 if (! &gst_file_run("svcs -a -H -ostate $service")); ++ return 0; ++} ++ + sub gst_service_installed + { + my ($service) = @_; +@@ -1975,6 +2199,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 +2239,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) = @_;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/system-tools-backends-03-disks.diff Thu Mar 16 09:25:39 2006 +0000 @@ -0,0 +1,220 @@ +diff -ru /var/tmp/clean/system-tools-backends-1.4.2/disks-conf.in system-tools-backends-1.4.2/disks-conf.in +--- /var/tmp/clean/system-tools-backends-1.4.2/disks-conf.in 2005-11-21 01:14:51.000000000 +0000 ++++ system-tools-backends-1.4.2/disks-conf.in 2006-03-13 10:14:56.140947000 +0000 +@@ -66,7 +66,7 @@ + @platforms = ("redhat-5.2", "redhat-6.0", "redhat-6.1", "redhat-6.2", "redhat-7.0", + "redhat-7.1", "mandrake-7.2", "debian-2.2", "debian-woody", "debian-sarge", + "debian-3.1", "suse-7.0", "suse-9.1", "suse-1.0", "unitedlinux-1.0", +- "turbolinux-7.0", "rpath"); ++ "turbolinux-7.0", "nexenta-1.0", "solaris-2.11"); + + $description =<<"end_of_description;"; + Configures locally mounted partitioned media. +@@ -83,7 +83,11 @@ + # Right now there's only one entry per array, as I couldn't find any + # typical deviations. + +-@fstab_names = ( "/etc/fstab" ); ++if ($$tool{"system"} eq "SunOS") { ++ @fstab_names = ( "/etc/vfstab" ); ++} else { ++ @fstab_names = ( "/etc/fstab" ); ++} + + + # --- Internal configuration variables --- # +@@ -698,7 +702,7 @@ + } + } + +-sub scan_ide_bus ++sub scan_ide_bus_linux + { + my $device = shift; + +@@ -733,7 +737,145 @@ + closedir (DIR); + } + +-sub scan_scsi_bus ++# wait_for(handle, regexp, regexp, ...) ++# Read from the input stream until one of the regexps matches.. ++sub wait_for ++{ ++ local ($c, $i, $sw, $rv, $ha); undef($wait_for_input); ++ $ha = $_[0]; ++ $codes = ++ "local \$hit;\n". ++ "while(1) {\n". ++ " if ((\$c = getc(\$ha)) eq \"\") { return -1; }\n". ++ " \$wait_for_input .= \$c;\n"; ++ for($i=1; $i<@_; $i++) { ++ $sw = $i>1 ? "elsif" : "if"; ++ $codes .= " $sw (\$wait_for_input =~ /$_[$i]/i) { \$hit = $i-1; }\n"; ++ } ++ $codes .= ++ " if (defined(\$hit)) {\n". ++ " \@matches = (-1, \$1, \$2, \$3, \$4, \$5, \$6, \$7, \$8, \$9);\n". ++ " return \$hit;\n". ++ " }\n". ++ " }\n"; ++ $rv = eval $codes; ++ if ($@) { ++ print STDERR $codes,"\n"; ++ &error("wait_for error : $@\n"); ++ } ++ return $rv; ++} ++ ++# text(message, [substitute]+) ++sub text ++{ ++ local $rv = $text{$_[0]}; ++ local $i; ++ for($i=1; $i<@_; $i++) { ++ $rv =~ s/\$$i/$_[$i]/g; ++ } ++ return $rv; ++} ++ ++# list_disks() ++# Returns a list of structures, one per disk ++sub list_disks_sunos ++{ ++ local(@rv); ++ local $temp = "/tmp/stb-format.tmp"; ++ open(TEMP, ">$temp"); ++ print TEMP "disk\n"; ++ close(TEMP); ++ open(FORMAT, "format -f $temp |"); ++ while(1) { ++ local $rv = &wait_for(FORMAT, 'Specify', '\s+\d+\. (\S+) <(.*) cyl (\d+) alt (\d+) hd (\d+) sec (\d+)>\s*(\S*)', '\s+\d+\. (\S+) <drive type unknown>', 'space for more'); ++ if ($rv == 0) { last; } ++ elsif ($rv == 1) { ++ local $disk = { 'device' => "/dev/dsk/$matches[1]", ++ 'type' => $matches[2] eq 'DEFAULT' ? ++ undef : $matches[2], ++ 'cyl' => $matches[3], ++ 'alt' => $matches[4], ++ 'hd' => $matches[5], ++ 'sec' => $matches[6], ++ 'volume' => $matches[7] }; ++ if ($matches[1] =~ /c(\d+)t(\d+)d(\d+)$/) { ++ $disk->{'desc'} = &text('select_device', ++ "$1", "$2", "$3"); ++ } ++ elsif ($matches[1] =~ /c(\d+)d(\d+)$/) { ++ $disk->{'desc'} = &text('select_idedevice', ++ chr($1*2 + $2 + 65)); ++ } ++ push(@rv, $disk); ++ } ++ } ++ close(FORMAT); ++ unlink($temp); ++ return @rv; ++} ++ ++# list_partitions(device) ++# Returns a list of structures, one per partition ++sub list_partitions_sunos ++{ ++ local(@rv, $secs, $i); ++ local @tag = ("unassigned", "boot", "root", "swap", "usr", "backup", "stand", "var", "home", "alternates", "cache"); ++ open(VTOC, "prtvtoc $_[0]s0 |"); ++ while(<VTOC>) { ++ if (/(\d+)\s+sectors\/cylinder/) { ++ $secs = $1; ++ } ++ if (/^\s+(\d+)\s+(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/) { ++ local $n = $1; ++ local $part = { 'tag' => $tag[$2], ++ 'flag' => $3 eq "00" ? "wm" : ++ $3 eq "01" ? "wu" : ++ $3 eq "10" ? "rm" : "ru", ++ 'start' => int($4 / $secs), ++ 'end' => int($6 / $secs), ++ 'device' => $_[0]."s$n" }; ++ $rv[$n] = $part; ++ } ++ } ++ close(VTOC); ++ for($i=0; $i<8 || $i<@rv; $i++) { ++ $rv[$i] = { 'tag' => 'unassigned', ++ 'flag' => 'wm', ++ 'device' => $_[0]."s$i" } if (!$rv[$i]); ++ if ($_[0] =~ /c(\d+)t(\d+)d(\d+)$/) { ++ $rv[$i]->{'desc'} = &text('select_part', ++ "$1", "$2", "$3", $i); ++ } ++ elsif ($_[0] =~ /c(\d+)d(\d+)$/) { ++ $rv[$i]->{'desc'} = &text('select_idepart', ++ chr($1*2 + $2 + 65), $i); ++ } ++ } ++ return @rv; ++} ++ ++sub scan_any_bus_sunos ++{ ++ my $device = shift; ++# foreach $disk (&list_disks_sunos()) { ++# &update_disk_data ($part->{'device'}, "media", $part->{'desc'}); ++# foreach $part (&list_partitions_sunos($disk->{'device'})) { ++# &update_disk_data ($part->{'device'}, "media", 'disk'); ++# if ($scsi[$i]->{'device'}) { &update_disk_data ($scsi[$i]->{'device'}, "model", "$vendor $model");} ++# } ++# } ++} ++ ++sub scan_ide_bus ++{ ++ my $device = shift; ++ ++ &scan_ide_bus_linux($device) if ($$tool{"system"} eq "Linux"); ++ &scan_ide_bus_sunos($device) if ($$tool{"system"} eq "SunOS"); ++} ++ ++sub scan_scsi_bus_linux + { + my $device = shift; + +@@ -833,7 +975,20 @@ + close (PROC_SCSI_FILE); + } + +-sub scan_floppy ++sub scan_scsi_bus_sunos ++{ ++ my $device = shift; ++} ++ ++sub scan_scsi_bus ++{ ++ my $device = shift; ++ ++ &scan_scsi_bus_linux($device) if ($$tool{"system"} eq "Linux"); ++ &scan_scsi_bus_sunos($device) if ($$tool{"system"} eq "SunOS"); ++} ++ ++sub scan_floppy_linux + { + #FIXME: I don't like it + $floppy = `grep fd /proc/devices | wc -l`; +@@ -849,6 +1004,16 @@ + } + } + ++sub scan_floppy_sunos ++{ ++} ++ ++sub scan_floppy ++{ ++ &scan_floppy_linux($device) if ($$tool{"system"} eq "Linux"); ++ &scan_floppy_sunos($device) if ($$tool{"system"} eq "SunOS"); ++} ++ + sub get_fs_type + { + my ($device) = @_;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/system-tools-backends-04-network.diff Thu Mar 16 09:25:39 2006 +0000 @@ -0,0 +1,1342 @@ +diff -ru /var/tmp/clean/system-tools-backends-1.4.2/network-conf.in system-tools-backends-1.4.2/network-conf.in +--- /var/tmp/clean/system-tools-backends-1.4.2/network-conf.in 2006-01-02 15:32:33.000000000 +0000 ++++ system-tools-backends-1.4.2/network-conf.in 2006-03-13 10:14:56.148512000 +0000 +@@ -77,7 +77,8 @@ + "vine-3.0", "vine-3.1", + "ark", + "slackware-9.1.0", "slackware-10.0.0", "slackware-10.1.0", "slackware-10.2.0", +- "gentoo", "vlos-1.2", "freebsd-5", "freebsd-6"); ++ "gentoo", "vlos-1.2", "freebsd-5", "freebsd-6", ++ "nexenta-1.0", "solaris-2.11"); + + $description =<<"end_of_description;"; + Configures all network parameters and interfaces. +diff -ru /var/tmp/clean/system-tools-backends-1.4.2/network.pl.in system-tools-backends-1.4.2/network.pl.in +--- /var/tmp/clean/system-tools-backends-1.4.2/network.pl.in 2006-01-02 15:50:54.000000000 +0000 ++++ system-tools-backends-1.4.2/network.pl.in 2006-03-13 14:41:21.087870000 +0000 +@@ -117,6 +117,332 @@ + return \@ifaces; + } + ++sub gst_network_sunos_get_network_lengths ++{ ++ my %netmasks; ++ open(NETMASKS, '/etc/netmasks') or return {}; ++ while(my $l = <NETMASKS>) { ++ chomp $l; ++ $l =~ s/#.*//; ++ $l =~ s/^\s+//; $l =~ s/\s+$//; ++ next if $l eq ''; ++ $l =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)\s+(\d+)\.(\d+)\.(\d+)\.(\d+)$/ or ++ next; ++ my @prefix = ($1, $2, $3, $4); ++ my @mask = ($5, $6, $7, $8); ++ # calculate prefix length of the network ++ my $prefix_bin = sprintf("%08b%08b%08b%08b", @prefix[0..3]); ++ $prefix_bin =~ s/0+$//; # this would be the right thing (see ifconfig(1m)) ++ # emulate Solaris apparent functionality: ++ $prefix_bin =~ s/0{1,8}$//; # only do bit-wise on the last byte ++ $prefix_bin =~ s/0{8}$//; ++ $prefix_bin =~ s/0{8}$//; ++ $prefix_bin =~ s/0{8}$//; ++ $netmasks{$prefix_bin}=\@mask; ++ } ++ return \%netmasks; ++} ++ ++# Get network-part of a host using /etc/netmasks. Returns two values: network as ++# quadded-IP and prefix length of the network. Example: ('129.132.0.0', 26) ++sub gst_network_sunos_ip2network ++{ ++ my ($ip) = @_; ++ $ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/; ++ my @ip = (int($1), int($2), int($3), int($4)); # don't ask me why the int are needed ++ my $netmasks = &gst_network_sunos_get_network_lengths(); ++ my ($max_length, $max_ip, $max_mask); ++ for my $prefix_bin (sort keys %$netmasks) { ++ my @net = map { $ip[$_] & $netmasks->{$prefix_bin}[$_] } (0..3); ++ my $net_bin = sprintf("%08b%08b%08b%08b", @net[0..3]); ++ if($net_bin =~ /^$prefix_bin/) { ++ if(not defined $max_length or length($prefix_bin)>$max_length) { ++ my $mask_bin = sprintf("%08b%08b%08b%08b", @{$netmasks->{$prefix_bin}}[0..3]); ++ $mask_bin =~ s/0+$//; ++ ($max_ip, $max_mask, $max_length) = ++ (join('.', @net), length($mask_bin), length($prefix_bin)); ++ } ++ } ++ } ++ if(defined $max_ip) { ++ return ($max_ip, $max_mask); ++ } ++ else { ++ return undef; ++ } ++} ++ ++# Calculate broadcast address (quadded notation) from the network (quadded ++# notation) + prefix length (number) ++sub gst_network_sunos_network2broadcast ++{ ++ my ($net, $prefix) = @_; ++ my @net = split(/\./, $net); ++ for (my $i=0; $i<4; $i++) { ++ my $prefix_byte = $prefix >= 8 ? 8 : $prefix; ++ $prefix -= $prefix_byte; ++ my $mask = ~((1 << (8-$prefix_byte)) - 1) & 255; ++ my $compl = (~ $mask) & 255; ++ $net[$i] |= $compl; ++ } ++ return join('.',@net); ++} ++ ++sub gst_network_sunos_length2netmask ++{ ++ my ($prefix) = @_; ++ my @mask; ++ for (my $i=0; $i<4; $i++) { ++ my $prefix_byte = $prefix >= 8 ? 8 : $prefix; ++ $prefix -= $prefix_byte; ++ $mask[$i] = ~((1 << (8-$prefix_byte)) - 1) & 255; ++ } ++ return join('.',@mask); ++} ++ ++sub gst_network_sunos_gateway_get ++{ ++ my ($dev) = @_; ++ my $buf = &gst_file_read_joined_lines ("/etc/defaultrouter.$dev"); ++ if ($buf =~ /^\s*([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\s*/) { ++ return $1; ++ } ++ if ($buf =~ /^\s*([0-9a-zA-Z-_]+)\s*/) { ++ return &gst_network_sunos_hosts_lookup ($1); ++ } ++ return ""; ++} ++ ++sub gst_network_sunos_broadcast_get ++{ ++ my ($dev) = @_; ++ my $address = &gst_network_sunos_address_get ($dev); ++ my @net = &gst_network_sunos_ip2network($address); ++ return &gst_network_sunos_network2broadcast (@net) if (defined $net[0]); ++ return "" ++} ++ ++sub gst_network_sunos_network_get ++{ ++ my ($dev) = @_; ++ my $address = &gst_network_sunos_address_get ($dev); ++ my @net = &gst_network_sunos_ip2network($address); ++ return $net[0] if (defined $net[0]); ++} ++ ++sub gst_network_sunos_netmask_get ++{ ++ my ($dev) = @_; ++ my $buf = &gst_file_read_joined_lines (&gst_network_sunos_interface($dev)); ++ if ($buf =~ /\s+netmask\s+\+\s*/ || ++ $buf =~ /^\s*[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\s*$/ || ++ $buf =~ /^\s*[0-9a-zA-Z-_]+\s*$/) { ++ my $address = &gst_network_sunos_address_get ($dev); ++ my @net = &gst_network_sunos_ip2network($address); ++ return &gst_network_sunos_length2netmask ($net[1]) if (defined $net[1]); ++ } elsif ($buf =~ /\s+netmask\s+([0-9.]+)\s*/) { ++ return $1; ++ } ++ ++ return "255.0.0.0"; ++} ++ ++sub gst_network_sunos_address_get ++{ ++ my ($dev) = @_; ++ my $buf = &gst_file_read_joined_lines (&gst_network_sunos_interface($dev)); ++ ++ if ($buf =~ /^\s*([0-9.]+)\s*/) { ++ return $1; ++ } elsif ($buf =~ /^\s*([0-9a-zA-Z-_]+)\s*/) { ++ return &gst_network_sunos_hosts_lookup ($1); ++ } ++ ++ return ""; ++} ++ ++sub gst_network_sunos_name_get ++{ ++ my ($dev) = @_; ++ return $dev; ++} ++ ++sub gst_network_sunos_ipmask2network ++{ ++ my ($ip, $mask) = @_; ++ my ($b1, $b2); ++ my @maskbyte = split /\./, $mask; ++ my @ipbyte = split /\./, $ip; ++ for (my $i=0; $i < 4; $i++) { ++ $b1 = $maskbyte[$i]+0; ++ $b2 = $ipbyte[$i]+0; ++ $netbyte = $b1 & $b2; ++ if ($i != 0) { ++ $netaddr = $netaddr . "." . $netbyte; ++ } else { ++ $netaddr = $netbyte; ++ } ++ } ++ return $netaddr; ++} ++ ++sub gst_network_sunos_address_set ++{ ++ my ($dev, $addr) = @_; ++ my ($file) = &gst_network_sunos_interface($dev); ++ ++ if (-e $file) { ++ my $buf = &gst_file_read_joined_lines ($file); ++ if ($buf =~ /^\s*([0-9.]+)(\s*.*)/) { ++ &gst_file_remove ($file); ++ &gst_file_buffer_save ("$addr$2\n", $file); ++ } elsif ($buf =~ /^\s*([0-9a-zA-Z-_]+)\s*/) { ++ my $host = $1; ++ my $updated = 0; ++ local (*INFILE, *OUTFILE); ++ ++ my ($ifh, $ofh) = &gst_file_open_filter_write_from_names("/etc/inet/ipnodes"); ++ if (not $ofh) { return; } # No point if we can't write. ++ *INFILE = $ifh; *OUTFILE = $ofh; ++ while (<INFILE>) { ++ if (/^\s*([0-9a-fA-F.:]+)\s+(.*$host.*)/) { ++ $updated = 1; ++ print OUTFILE "$addr\t$2\n"; ++ next; ++ } ++ print OUTFILE $_; ++ } ++ close INFILE; ++ close OUTFILE; ++ ++ my ($ifh, $ofh) = &gst_file_open_filter_write_from_names("/etc/hosts"); ++ if (not $ofh) { return; } # No point if we can't write. ++ *INFILE = $ifh; *OUTFILE = $ofh; ++ while (<INFILE>) { ++ if (/^\s*[0-9.]+(\s+.*$host.*)/) { ++ $updated = 1; ++ print OUTFILE "$addr$1\n"; ++ next; ++ } ++ print OUTFILE $_; ++ } ++ close INFILE; ++ ++ print OUTFILE "$addr\t\t$host\n" if (!$updated); ++ close OUTFILE; ++ ++ } else { ++ &gst_file_remove ($file); ++ &gst_file_buffer_save ("$addr\n", $file); ++ } ++ } else { ++ &gst_file_buffer_save ("$addr\n", $file); ++ } ++} ++ ++sub gst_network_sunos_netmask_set ++{ ++ my ($dev, $addr, $mask) = @_; ++ my ($file) = &gst_network_sunos_interface($dev); ++ my $buf = &gst_file_read_joined_lines ($file); ++ if ($buf =~ /^(\s*.*\s+netmask\s+)[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(\s*.*)/) { ++ &gst_file_remove ($file); ++ &gst_file_buffer_save ("$1$mask$2", $file); ++ } elsif (-e "/etc/netmasks" && ++ ($buf =~ /^\s*([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\s*$/ || ++ $buf =~ /^\s*(.*\s+netmask\s+)\+(\s*.*)/ || ++ $buf =~ /^\s*([0-9a-zA-Z-_]+)\s*$/)) { ++ my $updated = 0; ++ my $net = &gst_network_sunos_ipmask2network($addr, $mask); ++ local (*INFILE, *OUTFILE); ++ my ($ifh, $ofh) = &gst_file_open_filter_write_from_names("/etc/netmasks"); ++ if (not $ofh) { return; } # No point if we can't write. ++ *INFILE = $ifh; *OUTFILE = $ofh; ++ while (<INFILE>) { ++ if (/^\s*$net(\s+)[0-9.]+(.*)/) { ++ $updated = 1; ++ print OUTFILE "$net$1$mask$2\n"; ++ next; ++ } ++ print OUTFILE $_; ++ } ++ close INFILE; ++ print OUTFILE "$net\t\t$mask\n" if (!$updated); ++ close OUTFILE; ++ } elsif (! -e "/etc/netmasks") { ++ my $net = &gst_network_sunos_ipmask2network($addr, $mask); ++ &gst_file_buffer_save ("$net\t\t$mask\n", "/etc/netmasks"); ++ } ++} ++ ++sub gst_network_sunos_remote_address_set ++{ ++ my ($dev, $addr) = @_; ++} ++ ++sub gst_network_sunos_gateway_set ++{ ++ my ($dev, $gateway) = @_; ++ &gst_file_buffer_save ("$gateway\n", "/etc/defaultrouter.$dev"); ++} ++ ++sub gst_network_sunos_wireless_set ++{ ++ my ($dev, $opt, $value) = @_; ++ my ($profile) = "default"; ++ ++ if ($opt eq "essid") { ++ &gst_file_run ("wificonfig -i $dev setparam essid='$value'"); ++ } elsif ($opt eq "key_type") { ++ $value = "none" if ($value ne "WEP"); ++ &gst_file_run ("wificonfig -i $dev setparam encryption=$value"); ++ } elsif ($opt eq "key") { ++ &gst_file_run ("wificonfig -i $dev setparam wepkey1=$value"); ++ &gst_file_run ("wificonfig -i $dev setparam wepkeyindex=1"); ++ } ++ &gst_file_run ("wificonfig -i $dev saveprofile $profile"); ++} ++ ++sub gst_network_sunos_wireless_get ++{ ++ my ($dev, $opt) = @_; ++ my ($fd); ++ ++ $fd = &gst_file_run_pipe_read ("wificonfig -i $dev getparam"); ++ return {} if $fd eq undef; ++ while (<$fd>) { ++ return $1 if ($opt eq "essid" && /essid:\s+(.*)/); ++ if (/encryption:\s+(.*)/) { ++ return "************************" if ($opt eq "key" && $1 eq "WEP"); ++ return $1 if ($opt eq "key_type"); ++ } ++ } ++ &gst_file_close ($fd); ++ return ""; ++} ++ ++sub gst_network_get_sunos_wireless_ifaces ++{ ++ my ($fd, $dev); ++ my (@ifaces); ++ ++ my $allifaces = &gst_network_sunos_interfaces_get_info(); ++ foreach $dev (keys %$allifaces) { ++ $fd = &gst_file_run_pipe_read ("wificonfig -i $dev showstatus"); ++ return {} if $fd eq undef; ++ while (<$fd>) { ++ if (/linkstatus:/) { ++ push @ifaces, $dev; ++ last; ++ } ++ } ++ &gst_file_close ($fd); ++ } ++ ++ &gst_report_leave (); ++ return \@ifaces; ++} ++ + # Returns an array with the wireless devices found + sub gst_network_get_wireless_ifaces + { +@@ -124,6 +450,7 @@ + + return &gst_network_get_linux_wireless_ifaces if ($plat eq "Linux"); + return &gst_network_get_freebsd_wireless_ifaces if ($plat eq "FreeBSD"); ++ return &gst_network_get_sunos_wireless_ifaces if ($plat eq "SunOS"); + } + + # set of functions for enabling an interface +@@ -138,23 +465,44 @@ + + if ($essid) + { ++ $command = "wificonfig" if ($$tool{"system"} eq "SunOS"); + $command = $command_iwconfig if ($$tool{"system"} eq "Linux"); + $command = $command_ifconfig if ($$tool{"system"} eq "FreeBSD"); + +- $command .= " $dev"; +- $command .= " essid '$essid'" if ($essid); ++ if ($$tool{"system"} eq "SunOS") { ++ my $profile = "default"; ++ $command .= " -i $dev"; ++ &gst_file_run ("$command deleteprofile $profile"); ++ &gst_file_run ("$command createprofile $profile essid='$essid'"); ++ &gst_file_run ("$command removeprefer $profile"); ++ &gst_file_run ("$command setprefer $profile 1"); ++ my $param_command = " setparam essid='$essid'" if ($essid); ++ if ($key) ++ { ++ $key_type = "WEP" if ($key_type != "none"); ++ $param_command .= " encryption=$key_type wepkeyindex=1 wepkey1=$key"; ++ } ++ else ++ { ++ $param_command .= " encryption=none"; ++ } ++ &gst_file_run ($command . $param_command); ++ &gst_file_run ("$command saveprofile $profile"); ++ } else { ++ $command .= " $dev"; ++ $command .= " essid '$essid'" if ($essid); + +- if ($key) +- { +- $key = &gst_network_get_full_key ($key, $key_type); +- $command .= " key '$key'"; +- } +- else +- { +- $command .= " key off"; ++ if ($key) ++ { ++ $key = &gst_network_get_full_key ($key, $key_type); ++ $command .= " key '$key'"; ++ } ++ else ++ { ++ $command .= " key off"; ++ } ++ &gst_file_run ($command); + } +- +- &gst_file_run ($command); + } + } + +@@ -170,7 +518,21 @@ + + if ($bootproto eq "dhcp") + { +- if (&gst_file_locate_tool ("dhclient3")) ++ if ($$tool{"system"} eq "SunOS") ++ { ++ if (&gst_network_sunos_wireless_get ($dev, "essid")) { ++ my $profile = "default"; ++ &gst_file_run ("wificonfig -i $dev disconnect"); ++ &gst_file_run ("wificonfig -i $dev connect wait 0"); # hack ++ return -1 if (&gst_file_run ("wificonfig -i $dev connect $profile wait 30")); ++ } ++ $command = "ifconfig"; ++ $command .= " $dev"; ++ $command .= " auto-dhcp wait 45"; ++ &gst_file_remove ("/etc/.resolv.conf.bak"); ++ &gst_file_run ("cp /etc/resolv.conf /etc/.resolv.conf.bak"); ++ } ++ elsif (&gst_file_locate_tool ("dhclient3")) + { + $command = "dhclient3 -pf /var/run/dhclient.$dev.pid $dev"; + } +@@ -189,11 +551,22 @@ + $command .= " $dev"; + $command .= " $address" if ($address); + $command .= " netmask $netmask" if ($netmask); +- $command .= " dstaddr $remote_address" if ($remote_address); ++ if ($$tool{"system"} eq "SunOS") { ++ $command .= " destination $remote_address" if ($remote_address); ++ } else { ++ $command .= " dstaddr $remote_address" if ($remote_address); ++ } + $command .= " up"; + } + +- return &gst_file_run ($command); ++ $ret = &gst_file_run ($command); ++ if ($ret == 0 && $bootproto eq "dhcp" && $$tool{"system"} eq "SunOS") { ++ # ifconfig $dev auto-dhcp will overwrite /etc/resolv.conf ++ # so, we save it on per-device basis and restore original one ++ &gst_file_run ("mv /etc/resolv.conf /etc/.resolv.conf.$dev"); ++ &gst_file_run ("mv /etc/.resolv.conf.bak /etc/resolv.conf"); ++ } ++ return $ret; + } + + sub gst_network_get_chat_file +@@ -352,6 +725,10 @@ + { + @arr = ("/dev/modem", "/dev/cuaa0", "/dev/cuaa1", "/dev/cuaa2", "/dev/cuaa3"); + } ++ elsif ($$tool{"system"} eq "SunOS") ++ { ++ @arr = ("/dev/modem", "/dev/cua/a", "/dev/cua/b", "/dev/cua/c", "/dev/cua/d"); ++ } + + foreach $tty (@arr) { + $temp = `pppd lcp-max-configure 1 nodetach noauth nocrtscts $tty connect \"chat -t1 \'\' AT OK\" 2>/dev/null`; +@@ -480,7 +857,9 @@ + my %cmd_map = + ( + "debian-2.2" => "ping -c 2 -i 1 -n $bcast", +- "redhat-6.2" => "ping -c 2 -i 1 -n -b $bcast" ++ "redhat-6.2" => "ping -c 2 -i 1 -n -b $bcast", ++ "nexenta" => "ping -I 1 -s $bcast 56 2", ++ "solaris" => "ping -I 1 -s $bcast 56 2" + ); + my %dist_map = + ( +@@ -499,6 +878,8 @@ + "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", + "mandrake-7.1" => "debian-2.2", + "mandrake-7.2" => "debian-2.2", + "mandrake-9.0" => "debian-2.2", +@@ -792,7 +1173,12 @@ + } + } + +- if ($dev =~ /^(ppp|tun)/) ++ if ($dev =~ /^ip.tun/) ++ { ++ # Punchin Tunnel ++ $types_cache{$dev} = "punchin"; ++ } ++ elsif ($dev =~ /^(ppp|tun)/) + { + # check whether the proper plugin exists + if (&gst_network_check_pppd_plugin ("capiplugin")) +@@ -804,7 +1190,7 @@ + $types_cache{$dev} = "modem"; + } + } +- elsif ($dev =~ /^(eth|dc|ed|bfe|em|fxp|bge|de|xl|ixgb|txp|vx|lge|nge|pcn|re|rl|sf|sis|sk|ste|ti|tl|tx|vge|vr|wb|cs|ex|ep|fe|ie|lnc|sn|xe|le|an|awi|wi|ndis|wlaue|axe|cue|kue|rue|fwe|nve)[0-9]/) ++ elsif ($dev =~ /^(eth|dc|ed|bfe|em|fxp|bge|bcme|de|xl|ixgb|txp|vx|lge|nge|pcn|re|rl|sf|sis|sk|ste|ti|tl|tx|vge|vr|wb|cs|ex|ep|fe|ie|lnc|sn|xe|le|an|awi|wi|ndis|wlaue|axe|cue|kue|rue|fwe|nve)[0-9]/) + { + $types_cache{$dev} = "ethernet"; + } +@@ -895,12 +1281,49 @@ + return \%ifaces; + } + ++sub gst_network_sunos_interfaces_get_info ++{ ++ my ($dev, %ifaces, $fd); ++ ++ &gst_report_enter (); ++ &gst_report ("network_iface_active_get"); ++ ++ $fd = &gst_file_run_pipe_read ("ifconfig -a"); ++ return {} if $fd eq undef; ++ ++ while (<$fd>) ++ { ++ chomp; ++ if (/^\s*(.*):\s+.*(<.*>)/) ++ { ++ $dev = $1; ++ $ifaces{$dev}{"dev"} = $dev; ++ $ifaces{$dev}{"enabled"} = 0; ++ $ifaces{$dev}{"enabled"} = 1 if ($2 =~ /[<,]UP[,>]/); ++ } ++ ++ s/^[ \t]+//; ++ if ($dev) ++ { ++ $ifaces{$dev}{"hwaddr"} = $1 if /ether[ \t]+([^ \t]+)/i; ++ $ifaces{$dev}{"addr"} = $1 if /inet[ \t]+([^ \t]+)/i; ++ $ifaces{$dev}{"mask"} = $1 if /netmask[ \t]+([^ \t]+)/i; ++ $ifaces{$dev}{"bcast"} = $1 if /broadcast[ \t]+([^ \t]+)/i; ++ } ++ } ++ ++ &gst_file_close ($fd); ++ &gst_report_leave (); ++ return \%ifaces; ++} ++ + sub gst_network_interfaces_get_info + { + my (%ifaces); + + $ifaces = &gst_network_linux_interfaces_get_info if ($$tool{"system"} eq "Linux"); + $ifaces = &gst_network_freebsd_interfaces_get_info if ($$tool{"system"} eq "FreeBSD"); ++ $ifaces = &gst_network_sunos_interfaces_get_info if ($$tool{"system"} eq "SunOS"); + + foreach $dev (keys %$ifaces) + { +@@ -1182,6 +1605,117 @@ + return @ret; + } + ++sub gst_network_sunos_auto_get ++{ ++ my ($iface) = @_; ++ ++ return 1 if (-e "/etc/hostname.$iface"); ++ return 0; ++} ++ ++sub gst_network_sunos_auto_set ++{ ++ my ($iface, $active) = @_; ++ ++ if ($active == 1) { ++ if (-e "/etc/.hostname.$iface") { ++ &gst_file_run ("mv /etc/.hostname.$iface /etc/hostname.$iface"); ++ } else { ++ &gst_file_run ("touch /etc/hostname.$iface"); ++ } ++ if (-e "/etc/.dhcp.$iface") { ++ &gst_file_run ("mv /etc/.dhcp.$iface /etc/dhcp.$iface"); ++ } ++ } else { ++ if (-e "/etc/hostname.$iface") { ++ &gst_file_run ("mv /etc/hostname.$iface /etc/.hostname.$iface"); ++ } ++ if (-e "/etc/dhcp.$iface") { ++ &gst_file_run ("mv /etc/dhcp.$iface /etc/.dhcp.$iface"); ++ } ++ } ++} ++ ++sub gst_network_sunos_bootproto_get ++{ ++ my ($dev) = @_; ++ ++ my $fd = &gst_file_run_pipe_read("ls /etc/dhcp.* /etc/.dhcp.*"); ++ return undef if (!$fd); ++ ++ while (<$fd>) { ++ if (/\.?dhcp\.(.*)/) { ++ next if ($1 eq "xx0"); ++ return "dhcp" if ($1 eq $dev); ++ } ++ } ++ ++ &gst_file_close ($fd); ++ return "none"; ++} ++ ++sub gst_network_sunos_bootproto_set ++{ ++ my ($iface, $value) = @_; ++ ++ if ($value eq "none") { ++ &gst_file_remove ("/etc/dhcp.$iface"); ++ &gst_file_remove ("/etc/.dhcp.$iface"); ++ } elsif ($value eq "dhcp") { ++ if (-e "/etc/hostname.$iface") { ++ &gst_file_run ("touch /etc/dhcp.$iface"); ++ } elsif (-e "/etc/.hostname.$iface") { ++ &gst_file_run ("touch /etc/.dhcp.$iface"); ++ } ++ } ++} ++ ++sub gst_network_sunos_interface_activate ++{ ++ my ($hash, $old_hash, $enabled, $force) =@_; ++ ++ if ($force || &gst_network_interface_changed ($hash, $old_hash)) ++ { ++ my ($dev) = $$hash{"configuration"}{"file"}; ++ if ($enabled) ++ { ++ if (-e "/etc/dhcp.$dev" && /etc/.resolv.conf.$dev) { ++ &gst_file_run ("mv /etc/.resolv.conf.$dev /etc/resolv.conf"); ++ } ++ } ++ } ++} ++ ++sub gst_network_sunos_interface_delete ++{ ++} ++ ++sub gst_network_sunos_interface ++{ ++ my ($dev) = @_; ++ my ($file) = "hostname." . $dev; ++ return "/etc/$file" if (-e "/etc/$file"); ++ return "/etc/.$file"; ++} ++ ++sub gst_network_sunos_ifaces_get_existing ++{ ++ my @ret; ++ ++ my $fd = &gst_file_run_pipe_read("ls /etc/hostname.* /etc/.hostname.*"); ++ return undef if (!$fd); ++ ++ while (<$fd>) { ++ if (/\.?hostname\.(.*)/) { ++ next if ($1 eq "xx0"); ++ push @ret, $1; ++ } ++ } ++ ++ &gst_file_close ($fd); ++ return @ret; ++} ++ + sub gst_network_suse70_parse_iface_num + { + my ($file, $dev) = @_; +@@ -1672,7 +2206,7 @@ + $dev = "ppp0" if ($$tool{"system"} eq "Linux"); + $dev = "tun0" if ($$tool{"system"} eq "FreeBSD"); + +- if (!exists $$hash{$dev} && &gst_file_locate_tool ("pppd")) ++ if ($dev && !exists $$hash{$dev} && &gst_file_locate_tool ("pppd")) + { + $$hash{$dev}{"dev"} = $dev; + $$hash{$dev}{"enabled"} = 0; +@@ -1683,6 +2217,63 @@ + return \%$hash; + } + ++sub gst_network_sunos_search_in_hosts ++{ ++ my ($list, $host) = @_; ++ my @arr = (values %$list); ++ my @keys = (keys %$list); ++ for (my $i = 0; $i < length(@arr); $i++) { ++ for (my $j = 0; $j < length(@arr[$i]); $j++) { ++ return $keys[$i] if ($host eq $arr[$i][$j]); ++ } ++ } ++ return ""; ++} ++ ++sub gst_network_sunos_hosts_lookup ++{ ++ my ($host) = @_; ++ my $fd; ++ ++ $fd = &gst_file_open_read_from_names ("/etc/hosts"); ++ return undef if !$fd; ++ while (<$fd>) { ++ return $1 if (/^\s*([0-9.]+).*\s+$host.*/); ++ } ++ &gst_file_close ($fd); ++ ++ $fd = &gst_file_open_read_from_names ("/etc/inet/ipnodes"); ++ return undef if !$fd; ++ while (<$fd>) { ++ return $1 if (/^\s*([0-9.]+).*\s+$host.*/) ++ } ++ &gst_file_close ($fd); ++ ++ return ""; ++} ++ ++ ++sub gst_network_sunos_statichost_get ++{ ++ my ($hosts, $ipnodes) = @_; ++ my %list; ++ ++ if (!&gst_network_sunos_hosts_lookup ("localhost")) { ++ my $lofound = 0; ++ local *SVCS = &gst_file_run_pipe_read("ifconfig -a"); ++ while (<SVCS>) { ++ if (/lo0:\s*/) { $lofound = 1; next; } ++ if ($lofound && /inet\s*([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/) { ++ %list = ($1, "localhost"); ++ last; ++ } ++ } ++ close (SVCS); ++ } ++ ++ return \%list; ++} ++ + sub gst_network_conf_get + { + my %dist_attrib; +@@ -1743,6 +2334,12 @@ + return "$dev.$i"; + } + ++sub gst_network_sunos_get_file ++{ ++ my ($iface) = @_; ++ return &gst_network_sunos_interface ($$iface{"dev"}); ++} ++ + sub gst_network_deb22_get_file + { + my ($iface) = @_; +@@ -1816,6 +2413,8 @@ + "ubuntu-5.04" => \&gst_network_deb22_get_file, + "ubuntu-5.10" => \&gst_network_deb22_get_file, + "ubuntu-6.04" => \&gst_network_deb22_get_file, ++ "nexenta-1.0" => \&gst_network_sunos_get_file, ++ "solaris-2.11" => \&gst_network_sunos_get_file, + "suse-7.0" => \&gst_network_suse70_get_file, + "suse-9.0" => \&gst_network_deb22_get_file, + "suse-9.1" => \&gst_network_deb22_get_file, +@@ -1851,6 +2450,15 @@ + + sub gst_network_get_gateway_data + { ++ if ($$tool{"system"} eq "SunOS") { ++ return &gst_network_sunos_get_gateway_data (); ++ } else { ++ return &gst_network_linux_get_gateway_data (); ++ } ++} ++ ++sub gst_network_linux_get_gateway_data ++{ + my ($fd, $gateway, $dev); + + $fd = &gst_file_run_pipe_read ("route -n"); +@@ -1868,6 +2476,25 @@ + return ($gateway, $dev); + } + ++sub gst_network_sunos_get_gateway_data ++{ ++ my ($fd, $gateway, $dev); ++ ++ $fd = &gst_file_run_pipe_read ("netstat -rn"); ++ while (<$fd>) ++ { ++ if (/^default[ \t]+([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)[ \t]+.*[ \t]([a-zA-Z0-9]*)/) ++ { ++ $gateway = $1; ++ $dev = $2; ++ last; ++ } ++ } ++ ++ &gst_file_close ($fd); ++ return ($gateway, $dev); ++} ++ + sub gst_network_get_default_gatewaydev + { + my ($gateway, $dev) = &gst_network_get_gateway_data (); +@@ -1890,7 +2517,11 @@ + # Just in case. This means that no static gateway is needed. + return if $gateway eq ""; + +- $fd = &gst_file_run_pipe_read ("route -n"); ++ if ($$tool{"system"} eq "SunOS") { ++ $fd = &gst_file_run_pipe_read ("netstat -rn"); ++ } else { ++ $fd = &gst_file_run_pipe_read ("route -n"); ++ } + while (<$fd>) + { + if (/^0\.0\.0\.0[ \t]+([0-9.]+) /) +@@ -1910,8 +2541,14 @@ + if (($curr_gateway ne $gateway) || + ($curr_gatewaydev ne $gatewaydev)) + { +- &gst_file_run ("route del default gw $curr_gateway"); +- &gst_file_run ("route add default gw $gateway $gatewaydev"); ++ if ($$tool{"system"} eq "SunOS") { ++ &gst_file_run ("route delete default $curr_gateway"); ++ &gst_file_run ("route add default $gateway"); ++ &gst_file_buffer_save ("$gateway\n", "/etc/defaultrouter"); ++ } else { ++ &gst_file_run ("route del default gw $curr_gateway"); ++ &gst_file_run ("route add default gw $gateway $gatewaydev"); ++ } + } + } + +@@ -3827,21 +4464,45 @@ + my ($iface) = @_; + my ($fd, @arr, $encrypted); + +- # some wireless cards need to be up before scanning +- &gst_file_run ("ifconfig $iface up"); +- $fd = &gst_file_run_pipe_read ("iwlist $iface scanning"); +- return undef if (!$fd); +- +- while (<$fd>) +- { +- if (/^[ \t]*Encryption key:([^ \t\n]+)/) ++ if ($$tool{"system"} eq "SunOS") { ++ &gst_file_run ("ifconfig $iface plumb"); ++ &gst_file_run ("wificonfig -i $iface disconnect"); ++ $fd = &gst_file_run_pipe_read ("wificonfig -i $iface scan"); ++ return undef if (!$fd); ++ while (<$fd>) + { +- $encrypted = ($1 eq "off") ? 0 : 1; ++ if (/(.*)\s+([0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+)\s+(.*)\s+(WEP|none)\s+([0-9][0-5])/) { ++ my $essid = $1; ++ my $bssid = $2; ++ my $type = $3; ++ my $encryption = $4; ++ my $signallevel = $5; ++ ++ $essid =~ s/^\s+//; $essid =~ s/\s+$//; ++ $type =~ s/^\s+//; $type =~ s/\s+$//; ++ ++ $encrypted = ($encryption eq "none") ? 0 : 1; ++ push @arr, {"essid" => $essid, ++ "encrypted" => $encrypted }; ++ } + } +- elsif (/^[ \t]*ESSID\:"(.+)"/) ++ } else { ++ # some wireless cards need to be up before scanning ++ &gst_file_run ("ifconfig $iface up"); ++ $fd = &gst_file_run_pipe_read ("iwlist $iface scanning"); ++ return undef if (!$fd); ++ ++ while (<$fd>) + { +- push @arr, {"essid" => $1, +- "encrypted" => $encrypted }; ++ if (/^[ \t]*Encryption key:([^ \t\n]+)/) ++ { ++ $encrypted = ($1 eq "off") ? 0 : 1; ++ } ++ elsif (/^[ \t]*ESSID\:"(.+)"/) ++ { ++ push @arr, {"essid" => $1, ++ "encrypted" => $encrypted }; ++ } + } + } + +@@ -3936,6 +4597,8 @@ + "ubuntu-5.04" => "lo", + "ubuntu-5.10" => "lo", + "ubuntu-6.04" => "lo", ++ "nexenta-1.0" => "lo0", ++ "solaris-2.11" => "lo0", + "suse-7.0" => "", + "suse-9.0" => "", + "suse-9.1" => "", +@@ -3970,7 +4633,7 @@ + my %iface = ( + "auto" => 1, + "user" => 0, +- "dev" => "lo", ++ "dev" => "$dev", + "address" => "127.0.0.1", + "netmask" => "255.0.0.0", + "broadcast" => "127.255.255.255", +@@ -4101,6 +4764,8 @@ + "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" => "suse-7.0", + "suse-9.0" => "suse-9.0", + "suse-9.1" => "suse-9.0", +@@ -4479,6 +5144,79 @@ + [ "gatewaydev", \&gst_network_get_gateway_dev_from_address, "%interface%", "%gateway%" ], + ] + }, ++ ++ "nexenta" => ++ { ++ fn => ++ { ++ RESOLV_CONF => "/etc/resolv.conf", ++ HOST_CONF => "/etc/host.conf", ++ HOSTS => "/etc/hosts", ++ IPNODES => "/etc/inet/ipnodes", # IPv6 ++ HOSTNAME => "/etc/nodename", ++ SMB_CONF => "/etc/samba/smb.conf", ++ }, ++ table => ++ [ ++ [ "hostname", \&gst_parse_line_first, HOSTNAME ], ++ [ "gateway", \&gst_network_get_default_gateway ], ++ [ "gatewaydev", \&gst_network_get_default_gatewaydev ], ++# [ "gwdevunsup", \&gst_parse_trivial, 1 ], ++# [ "userifacectl", \&gst_parse_trivial, 0 ], ++ [ "domain", \&gst_parse_split_first_str, RESOLV_CONF, "domain", "[ \t]+" ], ++ [ "nameserver", \&gst_parse_split_all_hash_comment, RESOLV_CONF, "nameserver", "[ \t]+" ], ++ [ "searchdomain", \&gst_parse_split_first_array, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ], ++ [ "order", \&gst_parse_split_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ], ++ [ "hostmatch", \&gst_parse_split_first_bool, HOST_CONF, "multi", "[ \t]+" ], ++ [ "statichost", \&gst_network_sunos_statichost_get, HOSTS, IPNODES ], ++ [ "workgroup", \&gst_parse_ini, SMB_CONF, "global", "workgroup" ], ++ [ "smbdesc", \&gst_parse_ini, SMB_CONF, "global", "server string" ], ++ [ "winsserver", \&gst_parse_ini, SMB_CONF, "global", "wins server" ], ++ [ "winsuse", \&gst_parse_ini_bool, SMB_CONF, "global", "wins support" ], ++ [ "smbuse", \&gst_service_sysv_get_status_any, "smbd", "nmbd" ], ++ [ "smbinstalled", \&gst_service_sysv_installed, "samba" ], ++ [ "smartdhcpcd", \&gst_file_tool_installed, "pump" ], ++ [ "dialinstalled", \&gst_file_tool_installed, "wvdial" ], ++ [ "interface", \&gst_network_interfaces_get ] ++ ] ++ }, ++ ++ "solaris" => ++ { ++ fn => ++ { ++ RESOLV_CONF => "/etc/resolv.conf", ++ HOST_CONF => "/etc/host.conf", ++ HOSTS => "/etc/hosts", ++ IPNODES => "/etc/inet/ipnodes", # IPv6 ++ HOSTNAME => "/etc/nodename", ++ SMB_CONF => "/etc/sfw/smb.conf", ++ }, ++ table => ++ [ ++ [ "hostname", \&gst_parse_line_first, HOSTNAME ], ++ [ "gateway", \&gst_network_get_default_gateway ], ++ [ "gatewaydev", \&gst_network_get_default_gatewaydev ], ++# [ "gwdevunsup", \&gst_parse_trivial, 1 ], ++# [ "userifacectl", \&gst_parse_trivial, 0 ], ++ [ "domain", \&gst_parse_split_first_str, RESOLV_CONF, "domain", "[ \t]+" ], ++ [ "nameserver", \&gst_parse_split_all_hash_comment, RESOLV_CONF, "nameserver", "[ \t]+" ], ++ [ "searchdomain", \&gst_parse_split_first_array, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ], ++ [ "order", \&gst_parse_split_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ], ++ [ "hostmatch", \&gst_parse_split_first_bool, HOST_CONF, "multi", "[ \t]+" ], ++#DPK [ "statichost", \&gst_network_sunos_statichost_get, HOSTS, IPNODES ], ++ [ "statichost", \&gst_parse_split_hash, HOSTS, "[ \t]+", "[ \t]+" ], ++ [ "workgroup", \&gst_parse_ini, SMB_CONF, "global", "workgroup" ], ++ [ "smbdesc", \&gst_parse_ini, SMB_CONF, "global", "server string" ], ++ [ "winsserver", \&gst_parse_ini, SMB_CONF, "global", "wins server" ], ++ [ "winsuse", \&gst_parse_ini_bool, SMB_CONF, "global", "wins support" ], ++ [ "smbuse", \&gst_service_sysv_get_status_any, "smbd", "nmbd" ], ++ [ "smbinstalled", \&gst_service_sysv_installed, "samba" ], ++ [ "smartdhcpcd", \&gst_file_tool_installed, "pump" ], ++ [ "dialinstalled", \&gst_file_tool_installed, "wvdial" ], ++ [ "interface", \&gst_network_interfaces_get ] ++ ] ++ }, + ); + + my $dist = $dist_map{$gst_dist}; +@@ -4522,6 +5260,8 @@ + "ubuntu-5.04" => "debian-3.0", + "ubuntu-5.10" => "debian-3.0", + "ubuntu-6.04" => "debian-3.0", ++ "nexenta-1.0" => "nexenta", ++ "solaris-2.11" => "solaris", + "suse-7.0" => "suse-7.0", + "suse-9.0" => "suse-9.0", + "suse-9.1" => "suse-9.0", +@@ -5318,7 +6058,115 @@ + [ "persist", \&gst_network_get_freebsd5_ppp_persist, [ STARTIF, IFACE ]], + ] + }, +- ); ++ ++ "nexenta" => ++ { ++ ifaces_get => \&gst_network_sunos_ifaces_get_existing, ++ fn => ++ { ++ INTERFACES => "/etc", ++ IFACE => "#iface#", ++ CHAT => "/etc/chatscripts/%section%", ++ PPP_OPTIONS => "/etc/ppp/peers/%section%", ++ PAP => "/etc/ppp/pap-secrets", ++ CHAP => "/etc/ppp/chap-secrets", ++ }, ++ table => ++ [ ++# [ "user", \&gst_parse_trivial, 0 ], # not supported. ++ [ "dev", \&gst_parse_trivial, IFACE ], ++ [ "bootproto", \&gst_network_sunos_bootproto_get, IFACE ], ++ [ "auto", \&gst_network_sunos_auto_get, IFACE ], ++ [ "name", \&gst_network_sunos_name_get, [IFACE]], ++ [ "address", \&gst_network_sunos_address_get, [IFACE]], ++ [ "netmask", \&gst_network_sunos_netmask_get, [IFACE]], ++ [ "broadcast", \&gst_network_sunos_broadcast_get, [IFACE]], ++ [ "network", \&gst_network_sunos_network_get, [IFACE]], ++ [ "gateway", \&gst_network_sunos_gateway_get, [IFACE]], ++ [ "essid", \&gst_network_sunos_wireless_get, [IFACE, "essid" ]], ++ [ "key_type", \&gst_network_sunos_wireless_get, [IFACE, "key_type" ]], ++ [ "key", \&gst_network_sunos_wireless_get, [IFACE, "key" ]], ++ [ "remote_address", \&gst_network_debian_parse_remote_address, [INTERFACES, IFACE]], ++ [ "section", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "provider" ], ++ [ "update_dns", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_kw, PPP_OPTIONS, "usepeerdns" ]], ++ [ "noauth", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_kw, PPP_OPTIONS, "noauth" ]], ++ [ "mtu", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_split_first_str, PPP_OPTIONS, "mtu", "[ \t]+" ]], ++ [ "mru", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_split_first_str, PPP_OPTIONS, "mru", "[ \t]+" ]], ++ [ "serial_port", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^(/dev/[^ \t]+)" ]], ++ [ "serial_speed", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^([0-9]+)" ]], ++ [ "login", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^user \"?([^\"]*)\"?" ]], ++ [ "password", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_get_pap_passwd, PAP, "%login%" ]], ++ [ "password", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_get_pap_passwd, CHAP, "%login%" ]], ++ [ "ppp_options", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_unsup, PPP_OPTIONS ]], ++ [ "set_default_gw", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_kw, PPP_OPTIONS, "defaultroute" ]], ++ [ "debug", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_kw, PPP_OPTIONS, "debug" ]], ++ [ "persist", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_kw, PPP_OPTIONS, "persist" ]], ++ [ "serial_escapechars", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_split_first_str, PPP_OPTIONS, "escape", "[ \t]+" ]], ++ [ "serial_hwctl", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_kw, PPP_OPTIONS, "crtscts" ]], ++ [ "external_line", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_chat, CHAT, "atd[^0-9]([0-9*#]*)[wW]" ]], ++ [ "external_line", \&gst_network_check_type, [IFACE, "isdn", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^number[ \t]+(.+)[wW]" ]], ++ [ "phone_number", \&gst_network_check_type, [IFACE, "isdn", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^number.*[wW \t](.*)" ]], ++ [ "phone_number", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_chat, CHAT, "atd.*[ptwW]([0-9, -]+)" ]], ++ [ "dial_command", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_chat, CHAT, "(atd[tp])[0-9, -w]+" ]], ++ [ "volume", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_modem_volume, CHAT ]], ++ [ "enabled", \&gst_network_interface_active, IFACE, \&gst_network_active_interfaces_get ], ++ ] ++ }, ++ ++ "solaris" => ++ { ++ ifaces_get => \&gst_network_sunos_ifaces_get_existing, ++ fn => ++ { ++ INTERFACES => "/etc", ++ IFACE => "#iface#", ++ CHAT => "/etc/chatscripts/%section%", ++ PPP_OPTIONS => "/etc/ppp/peers/%section%", ++ PAP => "/etc/ppp/pap-secrets", ++ CHAP => "/etc/ppp/chap-secrets", ++ }, ++ table => ++ [ ++# [ "user", \&gst_parse_trivial, 0 ], # not supported. ++ [ "dev", \&gst_parse_trivial, IFACE ], ++ [ "bootproto", \&gst_network_sunos_bootproto_get, IFACE ], ++ [ "auto", \&gst_network_sunos_auto_get, IFACE ], ++ [ "name", \&gst_network_sunos_name_get, [IFACE]], ++ [ "address", \&gst_network_sunos_address_get, [IFACE]], ++ [ "netmask", \&gst_network_sunos_netmask_get, [IFACE]], ++ [ "broadcast", \&gst_network_sunos_broadcast_get, [IFACE]], ++ [ "network", \&gst_network_sunos_network_get, [IFACE]], ++ [ "gateway", \&gst_network_sunos_gateway_get, [IFACE]], ++ [ "essid", \&gst_network_sunos_wireless_get, [IFACE, "essid" ]], ++ [ "key_type", \&gst_network_sunos_wireless_get, [IFACE, "key_type" ]], ++ [ "key", \&gst_network_sunos_wireless_get, [IFACE, "key" ]], ++ [ "remote_address", \&gst_network_debian_parse_remote_address, [INTERFACES, IFACE]], ++ [ "section", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "provider" ], ++ [ "update_dns", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_kw, PPP_OPTIONS, "usepeerdns" ]], ++ [ "noauth", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_kw, PPP_OPTIONS, "noauth" ]], ++ [ "mtu", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_split_first_str, PPP_OPTIONS, "mtu", "[ \t]+" ]], ++ [ "mru", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_split_first_str, PPP_OPTIONS, "mru", "[ \t]+" ]], ++ [ "serial_port", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^(/dev/[^ \t]+)" ]], ++ [ "serial_speed", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^([0-9]+)" ]], ++ [ "login", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^user \"?([^\"]*)\"?" ]], ++ [ "password", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_get_pap_passwd, PAP, "%login%" ]], ++ [ "password", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_get_pap_passwd, CHAP, "%login%" ]], ++ [ "ppp_options", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_unsup, PPP_OPTIONS ]], ++ [ "set_default_gw", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_kw, PPP_OPTIONS, "defaultroute" ]], ++ [ "debug", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_kw, PPP_OPTIONS, "debug" ]], ++ [ "persist", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_kw, PPP_OPTIONS, "persist" ]], ++ [ "serial_escapechars", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_split_first_str, PPP_OPTIONS, "escape", "[ \t]+" ]], ++ [ "serial_hwctl", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_kw, PPP_OPTIONS, "crtscts" ]], ++ [ "external_line", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_chat, CHAT, "atd[^0-9]([0-9*#]*)[wW]" ]], ++ [ "external_line", \&gst_network_check_type, [IFACE, "isdn", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^number[ \t]+(.+)[wW]" ]], ++ [ "phone_number", \&gst_network_check_type, [IFACE, "isdn", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^number.*[wW \t](.*)" ]], ++ [ "phone_number", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_chat, CHAT, "atd.*[ptwW]([0-9, -]+)" ]], ++ [ "dial_command", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_chat, CHAT, "(atd[tp])[0-9, -w]+" ]], ++ [ "volume", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_modem_volume, CHAT ]], ++ [ "enabled", \&gst_network_interface_active, IFACE, \&gst_network_active_interfaces_get ], ++ ] ++ }, ++ ); + + my $dist = $dist_map{$gst_dist}; + return %{$dist_tables{$dist}} if $dist; +@@ -5360,6 +6208,8 @@ + "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" => "suse-7.0", + "suse-9.0" => "suse-9.0", + "suse-9.1" => "suse-9.0", +@@ -5723,7 +6573,69 @@ + [ "gateway", \&gst_replace_sh, RC_CONF, "defaultrouter" ], + [ "interface", \&gst_network_interfaces_set, OLD_HASH ] + ] +- } ++ }, ++ ++ "nexenta" => ++ { ++ fn => ++ { ++ RESOLV_CONF => "/etc/resolv.conf", ++ HOST_CONF => "/etc/host.conf", ++ HOSTS => "/etc/hosts", ++ HOSTNAME => "/etc/nodename", ++ SMB_CONF => "/etc/samba/smb.conf", ++ WVDIAL => "/etc/wvdial.conf" ++ }, ++ table => ++ [ ++ [ "hostname", \&gst_replace_line_first, HOSTNAME ], ++ [ "hostname", \&gst_network_run_hostname ], ++ [ "domain", \&gst_replace_join_first_str, RESOLV_CONF, "domain", "[ \t]+" ], ++ [ "nameserver", \&gst_replace_join_all, RESOLV_CONF, "nameserver", "[ \t]+" ], ++ [ "searchdomain", \&gst_replace_join_first_array, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ], ++ [ "order", \&gst_replace_join_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ], ++ [ "hostmatch", \&gst_replace_join_first_bool, HOST_CONF, "multi", "[ \t]+", "on", "off" ], ++ [ "statichost", \&gst_replace_join_hash, HOSTS, "[ \t]+", "[ \t]+" ], ++ [ "workgroup", \&gst_replace_ini, SMB_CONF, "global", "workgroup" ], ++ [ "smbdesc", \&gst_replace_ini, SMB_CONF, "global", "server string" ], ++ [ "winsserver", \&gst_replace_ini, SMB_CONF, "global", "wins server" ], ++ [ "winsuse", \&gst_replace_ini_bool, SMB_CONF, "global", "wins support" ], ++ [ "smbuse", \&gst_service_sysv_set_status, 91, "samba" ], ++ [ "interface", \&gst_network_interfaces_set, OLD_HASH ], ++ [ "gateway", \&gst_network_route_set_default_gw, "%gatewaydev%" ] ++ ] ++ }, ++ ++ "solaris" => ++ { ++ fn => ++ { ++ RESOLV_CONF => "/etc/resolv.conf", ++ HOST_CONF => "/etc/host.conf", ++ HOSTS => "/etc/hosts", ++ HOSTNAME => "/etc/nodename", ++ SMB_CONF => "/etc/samba/smb.conf", ++ WVDIAL => "/etc/wvdial.conf" ++ }, ++ table => ++ [ ++ [ "hostname", \&gst_replace_line_first, HOSTNAME ], ++ [ "hostname", \&gst_network_run_hostname ], ++ [ "domain", \&gst_replace_join_first_str, RESOLV_CONF, "domain", "[ \t]+" ], ++ [ "nameserver", \&gst_replace_join_all, RESOLV_CONF, "nameserver", "[ \t]+" ], ++ [ "searchdomain", \&gst_replace_join_first_array, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ], ++ [ "order", \&gst_replace_join_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ], ++ [ "hostmatch", \&gst_replace_join_first_bool, HOST_CONF, "multi", "[ \t]+", "on", "off" ], ++ [ "statichost", \&gst_replace_join_hash, HOSTS, "[ \t]+", "[ \t]+" ], ++ [ "workgroup", \&gst_replace_ini, SMB_CONF, "global", "workgroup" ], ++ [ "smbdesc", \&gst_replace_ini, SMB_CONF, "global", "server string" ], ++ [ "winsserver", \&gst_replace_ini, SMB_CONF, "global", "wins server" ], ++ [ "winsuse", \&gst_replace_ini_bool, SMB_CONF, "global", "wins support" ], ++ [ "smbuse", \&gst_service_sysv_set_status, 91, "samba" ], ++ [ "interface", \&gst_network_interfaces_set, OLD_HASH ], ++ [ "gateway", \&gst_network_route_set_default_gw, "%gatewaydev%" ] ++ ] ++ }, + ); + + my $dist = $dist_map{$gst_dist}; +@@ -5766,6 +6678,8 @@ + "ubuntu-5.04" => "debian-3.0", + "ubuntu-5.10" => "debian-3.0", + "ubuntu-6.04" => "debian-3.0", ++ "nexenta-1.0" => "nexenta", ++ "solaris-2.11" => "solaris", + "suse-7.0" => "suse-7.0", + "suse-9.0" => "suse-9.0", + "suse-9.1" => "suse-9.0", +@@ -6522,7 +7436,109 @@ + [ "dial_command", \&gst_network_replace_pppconf_dial_command, [ PPPCONF, STARTIF, IFACE ]], + [ "volume", \&gst_network_replace_pppconf_volume, [ PPPCONF, STARTIF, IFACE ]], + ] +- } ++ }, ++ ++ "nexenta" => ++ { ++ iface_set => \&gst_network_sunos_interface_activate, ++ iface_delete => \&gst_network_sunos_interface_delete, ++ ifaces_get => \&gst_network_sunos_ifaces_get_existing, ++ fn => ++ { ++ IFACE => "#iface#", ++ CHAT => "/etc/chatscripts/%section%", ++ PPP_OPTIONS => "/etc/ppp/peers/%section%", ++ PAP => "/etc/ppp/pap-secrets", ++ CHAP => "/etc/ppp/chap-secrets", ++ }, ++ table => ++ [ ++ [ "auto", \&gst_network_sunos_auto_set, [IFACE]], ++ [ "bootproto", \&gst_network_sunos_bootproto_set, [IFACE]], ++ [ "address", \&gst_network_sunos_address_set, [IFACE]], ++ [ "netmask", \&gst_network_sunos_netmask_set, [IFACE], "%address%" ], ++ [ "gateway", \&gst_network_sunos_gateway_set, [IFACE]], ++ [ "essid", \&gst_network_sunos_wireless_set, [IFACE], "essid" ], ++ [ "key", \&gst_network_sunos_wireless_set, [IFACE], "key" ], ++ [ "key_type", \&gst_network_sunos_wireless_set, [IFACE], "key_type" ], ++ [ "remote_address", \&gst_network_sunos_remote_address_set,[IFACE]], ++ # Modem stuff ++ [ "section", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_ppp_options_connect, PPP_OPTIONS ]], ++ [ "phone_number", \&gst_network_check_type, [IFACE, "modem", \&gst_network_create_pppscript, CHAT ]], ++ [ "phone_number", \&gst_network_check_type, [IFACE, "isdn", \&gst_network_create_isdn_options, PPP_OPTIONS ]], ++ [ "update_dns", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_kw, PPP_OPTIONS, "usepeerdns" ]], ++ [ "noauth", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_kw, PPP_OPTIONS, "noauth" ]], ++ [ "set_default_gw", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_kw, PPP_OPTIONS, "defaultroute" ]], ++ [ "debug", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_kw, PPP_OPTIONS, "debug" ]], ++ [ "persist", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_kw, PPP_OPTIONS, "persist" ]], ++ [ "serial_hwctl", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_kw, PPP_OPTIONS, "crtscts" ]], ++ [ "mtu", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_join_first_str, PPP_OPTIONS, "mtu", "[ \t]+" ]], ++ [ "mru", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_join_first_str, PPP_OPTIONS, "mru", "[ \t]+" ]], ++ [ "serial_port", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^(/dev/[^ \t]+)" ]], ++ [ "serial_speed", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^([0-9]+)" ]], ++ [ "login", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^user (.*)", "user \"%login%\"" ]], ++ [ "password", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_set_pap_passwd, PAP, "%login%" ]], ++ [ "password", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_set_pap_passwd, CHAP, "%login%" ]], ++ [ "serial_escapechars", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_join_first_str, PPP_OPTIONS, "escape", "[ \t]+" ]], ++ [ "dial_command", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_chat, CHAT, "(atd[tp])[0-9w, -]+" ]], ++ [ "phone_number", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_chat, CHAT, "atd[tp]([0-9w]+)" ]], ++ [ "external_line", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_chat, CHAT, "atd[tp]([0-9w, -]+)", "%external_line%W%phone_number%" ]], ++ [ "phone_number", \&gst_network_check_type, [IFACE, "isdn", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^number (.*)", "number %phone_number%" ]], ++ [ "external_line", \&gst_network_check_type, [IFACE, "isdn", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^number (.*)", "number %external_line%W%phone_number%" ]], ++ [ "volume", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_modem_volume, CHAT ]], ++ ] ++ }, ++ ++ "solaris" => ++ { ++ iface_set => \&gst_network_sunos_interface_activate, ++ iface_delete => \&gst_network_sunos_interface_delete, ++ ifaces_get => \&gst_network_sunos_ifaces_get_existing, ++ fn => ++ { ++ IFACE => "#iface#", ++ CHAT => "/etc/chatscripts/%section%", ++ PPP_OPTIONS => "/etc/ppp/peers/%section%", ++ PAP => "/etc/ppp/pap-secrets", ++ CHAP => "/etc/ppp/chap-secrets", ++ }, ++ table => ++ [ ++ [ "auto", \&gst_network_sunos_auto_set, [IFACE]], ++ [ "bootproto", \&gst_network_sunos_bootproto_set, [IFACE]], ++ [ "address", \&gst_network_sunos_address_set, [IFACE]], ++ [ "netmask", \&gst_network_sunos_netmask_set, [IFACE], "%address%" ], ++ [ "gateway", \&gst_network_sunos_gateway_set, [IFACE]], ++ [ "essid", \&gst_network_sunos_wireless_set, [IFACE], "essid" ], ++ [ "key", \&gst_network_sunos_wireless_set, [IFACE], "key" ], ++ [ "key_type", \&gst_network_sunos_wireless_set, [IFACE], "key_type" ], ++ [ "remote_address", \&gst_network_sunos_remote_address_set,[IFACE]], ++ # Modem stuff ++ [ "section", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_ppp_options_connect, PPP_OPTIONS ]], ++ [ "phone_number", \&gst_network_check_type, [IFACE, "modem", \&gst_network_create_pppscript, CHAT ]], ++ [ "phone_number", \&gst_network_check_type, [IFACE, "isdn", \&gst_network_create_isdn_options, PPP_OPTIONS ]], ++ [ "update_dns", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_kw, PPP_OPTIONS, "usepeerdns" ]], ++ [ "noauth", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_kw, PPP_OPTIONS, "noauth" ]], ++ [ "set_default_gw", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_kw, PPP_OPTIONS, "defaultroute" ]], ++ [ "debug", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_kw, PPP_OPTIONS, "debug" ]], ++ [ "persist", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_kw, PPP_OPTIONS, "persist" ]], ++ [ "serial_hwctl", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_kw, PPP_OPTIONS, "crtscts" ]], ++ [ "mtu", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_join_first_str, PPP_OPTIONS, "mtu", "[ \t]+" ]], ++ [ "mru", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_join_first_str, PPP_OPTIONS, "mru", "[ \t]+" ]], ++ [ "serial_port", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^(/dev/[^ \t]+)" ]], ++ [ "serial_speed", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^([0-9]+)" ]], ++ [ "login", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^user (.*)", "user \"%login%\"" ]], ++ [ "password", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_set_pap_passwd, PAP, "%login%" ]], ++ [ "password", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_set_pap_passwd, CHAP, "%login%" ]], ++ [ "serial_escapechars", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_join_first_str, PPP_OPTIONS, "escape", "[ \t]+" ]], ++ [ "dial_command", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_chat, CHAT, "(atd[tp])[0-9w, -]+" ]], ++ [ "phone_number", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_chat, CHAT, "atd[tp]([0-9w]+)" ]], ++ [ "external_line", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_chat, CHAT, "atd[tp]([0-9w, -]+)", "%external_line%W%phone_number%" ]], ++ [ "phone_number", \&gst_network_check_type, [IFACE, "isdn", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^number (.*)", "number %phone_number%" ]], ++ [ "external_line", \&gst_network_check_type, [IFACE, "isdn", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^number (.*)", "number %external_line%W%phone_number%" ]], ++ [ "volume", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_modem_volume, CHAT ]], ++ ] ++ }, + ); + + my $dist = $dist_map{$gst_dist};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/system-tools-backends-05-services.diff Thu Mar 16 09:25:39 2006 +0000 @@ -0,0 +1,447 @@ +diff -ru /var/tmp/clean/system-tools-backends-1.4.2/services-conf.in system-tools-backends-1.4.2/services-conf.in +--- /var/tmp/clean/system-tools-backends-1.4.2/services-conf.in 2006-01-02 15:32:34.000000000 +0000 ++++ system-tools-backends-1.4.2/services-conf.in 2006-03-13 10:14:56.155294000 +0000 +@@ -51,6 +51,7 @@ + + "debian-2.2", "debian-3.0", "debian-sarge", + ++ "nexenta-1.0", "solaris-2.11", + "suse-7.0", "turbolinux-7.0", "fedora-1", "fedora-2", "fedora-3", "rpath", + "pld-1.0", "pld-1.1", "pld-1.99", + "slackware-9.1.0", "slackware-10.0.0", "slackware-10.1.0", "slackware-10.2.0", +@@ -260,6 +261,7 @@ + sub xml_print_runlevels + { + my ($h, $default) = @_; ++ &gst_xml_print_pcdata ("longname", $i); + &gst_xml_print_line ("<runlevels>"); + &gst_xml_enter (); + +diff -ru /var/tmp/clean/system-tools-backends-1.4.2/share.pl.in system-tools-backends-1.4.2/share.pl.in +--- /var/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-03-13 10:14:56.155671000 +0000 +@@ -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($file)) { ++ 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 (!$first); ++ if (&gst_share_nfs_client_info_get_write ($client)) { $line .= "rw="; ++ } ++ else { $line .= "ro="; } ++ $line .= &gst_share_nfs_client_info_get_pattern ($client); ++ } ++ $first = 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,11 @@ + &gst_share_nfs_exports_remove_entry ($file, $old_info); + } + } ++ ++ if ($$tool{"system"} eq "SunOS") { ++ &gst_file_run ("unshareall"); ++ &gst_file_run ("/bin/sh $file"); ++ } + } + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/system-tools-backends-06-shares.diff Thu Mar 16 09:25:39 2006 +0000 @@ -0,0 +1,75 @@ +diff -ru /var/tmp/clean/system-tools-backends-1.4.2/shares-conf.in system-tools-backends-1.4.2/shares-conf.in +--- /var/tmp/clean/system-tools-backends-1.4.2/shares-conf.in 2005-11-21 01:19:47.000000000 +0000 ++++ system-tools-backends-1.4.2/shares-conf.in 2006-03-13 10:14:56.156020000 +0000 +@@ -68,6 +68,7 @@ + "mandrake-10.0", "mandrake-10.1", + "blackpanther-4.0", + "debian-2.2", "debian-3.0", "debian-sarge", ++ "nexenta-1.0", "solaris-2.11", + "suse-7.0", "suse-9.0", + "turbolinux-7.0", "fedora-1", "fedora-2", "fedora-3", + "pld-1.0", "pld-1.1", "pld-1.99", +@@ -389,7 +390,7 @@ + &gst_xml_print_line ("<export type='nfs'>"); + &gst_xml_enter (); + +- &gst_xml_print_pcdata ("name", "unknown"); ++ &gst_xml_print_pcdata ("name", &gst_share_nfs_info_get_name ($info)); + &gst_xml_print_pcdata ("path", &gst_share_nfs_info_get_point ($info)); + + for $client (@$client_table) +@@ -537,6 +538,8 @@ + "debian-2.2" => "debian-2.2", + "debian-3.0" => "debian-2.2", + "debian-sarge" => "debian-2.2", ++ "nexenta-1.0" => "nexenta", ++ "solaris-2.11" => "solaris", + "suse-7.0" => "redhat-6.2", + "suse-9.0" => "suse-9.0", + "suse-9.1" => "suse-9.0", +@@ -608,6 +611,22 @@ + [ "smbinstalled", \&gst_service_installed, "samba" ], + # FIXME: How's the nfs stuff in FreeBSD? + ]}, ++ ++ "nexenta" => { ++ table => [ ++ [ "smbuse", \&gst_service_sysv_get_status_any, "smbd", "nmbd" ], ++ [ "smbinstalled", \&gst_service_sysv_installed, "samba" ], ++ [ "nfsuse", \&gst_service_installed, "nfs/client" ], ++ [ "nfsinstalled", \&gst_service_installed, "nfs/server" ], ++ ]}, ++ ++ "solaris" => { ++ table => [ ++ [ "smbuse", \&gst_service_sysv_get_status_any, "smbd", "nmbd" ], ++ [ "smbinstalled", \&gst_service_sysv_installed, "samba" ], ++ [ "nfsuse", \&gst_service_installed, "nfs/client" ], ++ [ "nfsinstalled", \&gst_service_installed, "nfs/server" ], ++ ]}, + ); + + my $dist = $dist_map{$gst_dist}; +@@ -647,8 +666,11 @@ + %dist_attrib = &gst_network_get_parse_table (); + $smb_conf = $dist_attrib{"fn"}{"SMB_CONF"}; + +- # This is pretty standard +- $exports = "/etc/exports"; ++ if ($$tool{"system"} eq "SunOS") { ++ $exports = "/etc/dfs/dfstab"; ++ } else { ++ $exports = "/etc/exports"; ++ } + + return ($smb_conf, $exports); + } +@@ -771,7 +793,7 @@ + foreach $i (keys %$ifaces) + { + if (($$ifaces{$i}{"enabled"} == 1) +- && ($$ifaces{$i}{"dev"} ne "lo")) ++ && !($$ifaces{$i}{"dev"} =~ /^lo[0-9]?/)) + { + $$ifaces{$i}{"network"} = &gst_network_ipv4_calc_subnet ($$ifaces{$i}{"addr"}, + $$ifaces{$i}{"mask"});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/system-tools-backends-07-time.diff Thu Mar 16 09:25:39 2006 +0000 @@ -0,0 +1,187 @@ +diff -ru /var/tmp/clean/system-tools-backends-1.4.2/time-conf.in system-tools-backends-1.4.2/time-conf.in +--- /var/tmp/clean/system-tools-backends-1.4.2/time-conf.in 2006-01-02 15:47:30.000000000 +0000 ++++ system-tools-backends-1.4.2/time-conf.in 2006-03-13 10:14:56.156628000 +0000 +@@ -67,6 +67,7 @@ + "mandrake-7.1", "mandrake-7.2", "mandrake-9.0", "mandrake-9.1", "mandrake-9.2", + "mandrake-10.0", "mandrake-10.1", + "debian-2.2", "debian-3.0", "debian-sarge", ++ "nexenta-1.0", "solaris-2.11", + "suse-7.0", "suse-9.0", "suse-9.1", "turbolinux-7.0", + "slackware-8.0.0", "slackware-8.1", "slackware-9.0.0", "slackware-9.1.0", "slackware-10.0.0", "slackware-10.1.0", "slackware-10.2.0", + "gentoo", "vlos-1.2", "pld-1.0", "pld-1.1", "pld-1.99", "fedora-1", "fedora-2", "fedora-3", "rpath", +@@ -277,6 +278,12 @@ + return \%h; + } + ++sub time_get_sunos_zone ++{ ++ local *RTC=gst_file_run_pipe_read("rtc"); ++ return <RTC>; ++} ++ + sub time_get_rh62_zone + { + my ($local_time_file, $zoneinfo_dir) = @_; +@@ -318,8 +325,8 @@ + $zone = ""; + } + +- return $zone; + close (TZLIST); ++ return $zone; + } + + sub conf_get +@@ -342,7 +349,13 @@ + my ($plat) = $$tool {"system"}; + my ($command); + ++ my $sunos_table = { ++ "nexenta-1.0" => "date %02d%02d%02d%02d%04d.%02d", ++ "solaris-2.11" => "date %%m%%d%%H%%M%%Y.%%S %02d%02d%02d%02d%04d.%02d" ++ }; ++ + my $plat_table = { ++ "SunOS" => $$sunos_table {$$tool {"platform"}}, + "Linux" => "date %02d%02d%02d%02d%04d.%02d", + "FreeBSD" => "date -f %%m%%d%%H%%M%%Y.%%S %02d%02d%02d%02d%04d.%02d" + }; +@@ -378,6 +391,49 @@ + return 0; + } + ++sub time_set_sunos_zone ++{ ++ my ($localtime, $zonebase, $timezone) = @_; ++ my ($ifh, $ofh); ++ local (*INFILE, *OUTFILE); ++ ++ ($ifh, $ofh) = &gst_file_open_filter_write_from_names("/etc/default/init"); ++ if (not $ofh) { return; } # No point if we can't write. ++ *INFILE = $ifh; *OUTFILE = $ofh; ++ ++ &gst_report_enter (); ++ &gst_report ("time_timezone_set", $timezone); ++ ++ &gst_file_run ("rtc -z $timezone"); ++ ++ while (<INFILE>) ++ { ++ if (/^TZ\s*=\s*(.*)/) { ++ print OUTFILE "TZ=$timezone\n"; ++ next; ++ } ++ print OUTFILE $_; ++ } ++ close OUTFILE; ++ close INFILE; ++ ++ # update /etc/localtime too, so unported GNU software will not complain ++ my $tz = "$zonebase/$timezone"; ++ if (stat($tz) ne "") ++ { ++ unlink $localtime; # Important, since it might be a symlink. ++ ++ &gst_report_enter (); ++ $res = copy ($tz, $localtime); ++ &gst_report_leave (); ++ return -1 unless $res; ++ return 0; ++ } ++ ++ &gst_report_leave (); ++ return -1; ++} ++ + sub time_set_archlinux_zone + { + my ($localtime, $zonebase, $timezone) =@_; +@@ -560,6 +616,10 @@ + "debian-3.0" => "debian-3.0", + "debian-sarge" => "debian-3.0", + ++ "nexenta-1.0" => "nexenta", ++ ++ "solaris-2.11" => "solaris", ++ + "suse-7.0" => "suse-7.0", + "suse-9.0" => "suse-9.0", + "suse-9.1" => "suse-9.0", +@@ -758,7 +818,23 @@ + [ "ntpinstalled", \&gst_service_rcng_installed, [ "ntpd", "openntpd" ]], + ] + }, +- ++ ++ "solaris" => ++ { ++ fn => ++ { ++ NTP_CONF => "/etc/inet/ntp.conf" ++ }, ++ table => ++ [ ++ [ "local_time", \&time_get_local_time ], ++ [ "timezone", \&time_get_sunos_zone ], ++ [ "sync", \&gst_parse_split_all_array_with_pos, NTP_CONF, "server", 0, "[ \t]+", "[ \t]+" ], ++ [ "sync_active", \&gst_service_smf_get_status, "network/ntp" ], ++ [ "ntpinstalled", \&gst_service_installed, "network/ntp" ], ++ ] ++ }, ++ + "freebsd-5" => + { + fn => +@@ -813,6 +889,10 @@ + "debian-3.0" => "debian-3.0", + "debian-sarge" => "debian-3.0", + ++ "nexenta-1.0" => "nexenta", ++ ++ "solaris-2.11" => "solaris", ++ + "suse-7.0" => "suse-7.0", + "suse-9.0" => "suse-9.0", + "suse-9.1" => "suse-9.0", +@@ -1000,6 +1080,41 @@ + [ "sync_active", \&gst_service_archlinux_set_status, "ntpd", "%sync_active%" ], + ] + }, ++ ++ "nexenta" => ++ { ++ fn => ++ { ++ NTP_CONF => "/etc/inet/ntp.conf", ++ ZONEINFO => "/usr/share/lib/zoneinfo", ++ LOCAL_TIME => "/etc/localtime" ++ }, ++ table => ++ [ ++ [ "timezone", \&time_set_sunos_zone, [LOCAL_TIME, ZONEINFO] ], ++ [ "local_time", \&time_set_local_time ], ++ [ "sync", \&time_replace_ntp_servers, NTP_CONF, "server", "[ \t]+" ], ++ [ "sync_active", \&gst_service_smf_set_status, "network/ntp", "%sync_active%" ], ++ ] ++ }, ++ ++ "solaris" => ++ { ++ fn => ++ { ++ NTP_CONF => "/etc/inet/ntp.conf", ++ ZONEINFO => "/usr/share/lib/zoneinfo", ++ LOCAL_TIME => "/etc/localtime" ++ }, ++ table => ++ [ ++ [ "timezone", \&time_set_sunos_zone, [LOCAL_TIME, ZONEINFO] ], ++ [ "local_time", \&time_set_local_time ], ++ [ "sync", \&time_replace_ntp_servers, NTP_CONF, "server", "[ \t]+" ], ++ [ "sync_active", \&gst_service_smf_set_status, "network/ntp", "%sync_active%" ], ++ ] ++ }, ++ + + "freebsd-5" => + {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/system-tools-backends-08-users.diff Thu Mar 16 09:25:39 2006 +0000 @@ -0,0 +1,99 @@ +diff -ru /var/tmp/clean/system-tools-backends-1.4.2/users-conf.in system-tools-backends-1.4.2/users-conf.in +--- /var/tmp/clean/system-tools-backends-1.4.2/users-conf.in 2006-01-02 15:48:06.000000000 +0000 ++++ system-tools-backends-1.4.2/users-conf.in 2006-03-13 10:14:56.157366000 +0000 +@@ -74,6 +74,7 @@ + "mandrake-7.1", "mandrake-7.2", "mandrake-9.0", "mandrake-9.1", "mandrake-9.2", + "mandrake-10.0", "mandrake-10.1", + "debian-2.2", "debian-3.0", "debian-sarge", ++ "nexenta-1.0", "solaris-2.11", + "suse-7.0", "suse-9.0", "suse-9.1", "turbolinux-7.0", + "slackware-8.0.0", "slackware-8.1", "slackware-9.0.0", "slackware-9.1.0", "slackware-10.0.0", "slackware-10.1.0", "slackware-10.2.0", + "freebsd-4", "freebsd-5", "freebsd-6", +@@ -117,7 +118,7 @@ + %users_prop_map = (); + @users_prop_array = (); + +-if ($$tool{"platform"} eq "Linux") ++if ($$tool{"platform"} eq "Linux" || $$tool{"platform"} eq "SunOS") + { + @users_prop_array = ( + "key", 0, +@@ -315,6 +316,20 @@ + } + } + ++my $nexenta_logindefs_defaults = { ++ 'shell' => '/bin/bash', ++ 'group' => 'users', ++ 'skel_dir' => '/etc/skel/', ++ 'home_prefix' => '/export/home/$user', ++}; ++ ++my $solaris_logindefs_defaults = { ++ 'shell' => '/bin/bash', ++ 'group' => 'users', ++ 'skel_dir' => '/etc/skel/', ++ 'home_prefix' => '/home/$user', ++}; ++ + my $rh_logindefs_defaults = { + 'shell' => '/bin/bash', + 'group' => '$user', +@@ -362,6 +377,8 @@ + 'debian-2.2' => $rh_logindefs_defaults, + 'debian-3.0' => $rh_logindefs_defaults, + 'debian-sarge' => $rh_logindefs_defaults, ++ 'nexenta-1.0' => $nexenta_logindefs_defaults, ++ 'solaris-2.11' => $solaris_logindefs_defaults, + 'vine-3.0' => $rh_logindefs_defaults, + 'vine-3.1' => $rh_logindefs_defaults, + 'gentoo' => $gentoo_logindefs_defaults, +@@ -886,7 +903,7 @@ + $fname = "-f \'" . $fname . "\'"; + $home_phone = "-h \'" . $home_phone . "\'"; + +- if ($gst_dist =~ /^debian/ || $gst_dist =~ /^archlinux/) ++ if ($gst_dist =~ /^debian/ || $gst_dist =~ /^archlinux/ || $gst_dist =~ /^nexenta/) + { + $office = "-r \'" . $office . "\'"; + $office_phone = "-w \'" . $office_phone . "\'"; +@@ -932,6 +949,21 @@ + print $pwdpipe $$data[$users_prop_map{"password"}]; + &gst_file_close ($pwdpipe); + } ++ elsif ($gst_dist =~ /^nexenta/) ++ { ++ my $pwdpipe; ++ $home_parents = $$data[$users_prop_map{"home"}]; ++ $home_parents =~ s/\/+[^\/]+\/*$//; ++ &gst_file_run ("$tool_mkdir -p $home_parents"); ++ ++ $command = "$cmd_useradd" . " -d \'" . $$data[$users_prop_map{"home"}] . ++ "\' -g \'" . $$data[$users_prop_map{"gid"}] . ++ "\' -s \'" . $$data[$users_prop_map{"shell"}] . ++ "\' -u \'" . $$data[$users_prop_map{"uid"}] . ++ "\' \'" . $$data[$users_prop_map{"login"}] . "\'"; ++ &gst_file_run ($command); ++ &gst_file_run("echo " . $$data[$users_prop_map{"login"}] . ":" . $$data[$users_prop_map{"password"}] . " | chpasswd -e"); ++ } + else + { + $home_parents = $$data[$users_prop_map{"home"}]; +@@ -970,6 +1002,17 @@ + print $pwdpipe $$data[$users_prop_map{"password"}]; + &gst_file_close ($pwdpipe); + } ++ elsif ($gst_dist =~ /^nexenta/) ++ { ++ $command = "$cmd_usermod" . " -d \'" . $$new_data[$users_prop_map{"home"}] . ++ "\' -g \'" . $$new_data[$users_prop_map{"gid"}] . ++ "\' -l \'" . $$new_data[$users_prop_map{"login"}] . ++ "\' -s \'" . $$new_data[$users_prop_map{"shell"}] . ++ "\' -u \'" . $$new_data[$users_prop_map{"uid"}] . ++ "\' \'" . $$old_data[$users_prop_map{"login"}] . "\'"; ++ &gst_file_run ($command); ++ &gst_file_run("echo " . $$data[$users_prop_map{"login"}] . ":" . $$data[$users_prop_map{"password"}] . " | chpasswd -e"); ++ } + else + { + $command = "$cmd_usermod" . " -d \'" . $$new_data[$users_prop_map{"home"}] .
--- a/system-tools-backends.spec Thu Mar 16 09:13:32 2006 +0000 +++ b/system-tools-backends.spec Thu Mar 16 09:25:39 2006 +0000 @@ -16,6 +16,14 @@ Vendor: Sun Microsystems, Inc. Summary: Backends for the GNOME System Tools Source: http://ftp.gnome.org/pub/GNOME/sources/system-tools-backends/1.4/%{name}-%{version}.tar.bz2 +Patch1: system-tools-backends-01-boot.diff +Patch2: system-tools-backends-02-common.diff +Patch3: system-tools-backends-03-disks.diff +Patch4: system-tools-backends-04-network.diff +Patch5: system-tools-backends-05-services.diff +Patch6: system-tools-backends-06-shares.diff +Patch7: system-tools-backends-07-time.diff +Patch8: system-tools-backends-08-users.diff URL: http://www.gnome.org BuildRoot: %{_tmppath}/%{name}-%{version}-build Docdir: %{_defaultdocdir}/%{name} @@ -34,6 +42,14 @@ %prep %setup -q +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 %build @@ -69,6 +85,9 @@ %{_datadir}/locale/*/LC_MESSAGES/*.mo %changelog +* Thu Mar 16 2006 - [email protected] +- Move patches here from Solaris package spec file. + * Sun Jan 29 2006 - [email protected] - Bump to 1.4.2