patches/system-tools-backends-05-services.diff
changeset 11797 7784792b3624
parent 11206 adf287112705
--- a/patches/system-tools-backends-05-services.diff	Wed Mar 05 14:27:27 2008 +0000
+++ b/patches/system-tools-backends-05-services.diff	Wed Mar 05 15:35:49 2008 +0000
@@ -41,10 +41,10 @@
    &gst_xml_print_line ("<runlevels>");
    &gst_xml_enter ();
  
-diff -u system-tools-backends-1.4.2/service.pl.in-orig system-tools-backends-1.4.2/service.pl.in
---- system-tools-backends-1.4.2/service.pl.in-orig	2006-01-02 23:42:19.000000000 +0800
-+++ system-tools-backends-1.4.2/service.pl.in	2007-11-15 17:37:32.744150000 +0800
-@@ -85,6 +85,9 @@
+diff -up system-tools-backends-1.4.2/service.pl.in-clean system-tools-backends-1.4.2/service.pl.in
+--- system-tools-backends-1.4.2/service.pl.in-clean	2006-01-02 15:42:19.000000000 +0000
++++ system-tools-backends-1.4.2/service.pl.in	2008-03-05 14:00:46.119320000 +0000
+@@ -85,6 +85,9 @@ sub gst_service_sysv_get_paths
         "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"],
         
@@ -54,7 +54,7 @@
         "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 @@
+@@ -154,6 +157,9 @@ sub gst_service_sysv_get_runlevels
         "ubuntu-5.04"    => [2, 3],
         "ubuntu-5.10"    => [2, 3],
         "ubuntu-6.04"    => [2, 3],
@@ -64,7 +64,7 @@
         
         "suse-7.0"       => [3, 5],
         "suse-9.0"       => [3, 5],
-@@ -223,6 +229,10 @@
+@@ -223,6 +229,10 @@ sub gst_service_get_runlevel_roles
       "ubuntu-5.04"    => "debian-2.2",
       "ubuntu-5.10"    => "debian-2.2",
       "ubuntu-6.04"    => "debian-2.2",
@@ -75,7 +75,7 @@
            
       "suse-7.0"       => "redhat-5.2",
       "suse-9.0"       => "redhat-5.2",
-@@ -277,6 +287,14 @@
+@@ -277,6 +287,14 @@ sub gst_service_get_runlevel_roles
                        "default"   => "GRAPHICAL",
                        "nonetwork" => "RECOVER"
                       },
@@ -90,7 +90,7 @@
       "freebsd-5"  => {"rc" => "GRAPHICAL" },
       "slackware-9.1.0" => {"4" => "GRAPHICAL" }
      );
-@@ -797,6 +815,160 @@
+@@ -797,6 +815,159 @@ sub gst_service_bsd_get_services
    return \%ret;
  }
  
@@ -194,8 +194,7 @@
 +  $hash{"script"} = $service;
 +  $hash{"longname"} = $longname if ($longname);
 +  $hash{"runlevels"} = $runlevels unless ($runlevels eq undef);
-+  $service =~ m/.*\/(.*)$/;
-+  $role = &gst_service_get_role ($1);
++  $role = &gst_service_get_role ($service);
 +
 +  if ($role eq "UNKNOWN") {
 +    $role = "SYSTEM" if ($service =~ /^system\// || $service =~ /^platform\//);
@@ -251,7 +250,7 @@
  # these functions get a list of the services that run on a gentoo init
  sub gst_service_gentoo_get_service_status
  {
-@@ -1163,6 +1335,10 @@
+@@ -1163,6 +1334,10 @@ sub gst_get_init_type
    {
      return "suse";
    }
@@ -262,7 +261,7 @@
    else
    {
      return "sysv";
-@@ -1180,6 +1356,8 @@
+@@ -1180,6 +1355,8 @@ sub gst_service_get_services
    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");
@@ -271,7 +270,7 @@
    return undef;
  }
  
-@@ -1199,7 +1377,7 @@
+@@ -1199,7 +1376,7 @@ sub gst_service_get_default_runlevel
  {
      my ($type) = &gst_get_init_type ();
  
@@ -280,7 +279,7 @@
      return "rc"      if ($type eq "rcng");
      return "rc"      if ($type eq "archlinux");
      return &gst_service_sysv_get_default_runlevel ();
-@@ -1585,6 +1763,7 @@
+@@ -1585,6 +1762,7 @@ sub gst_service_set_services
    &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");
@@ -288,7 +287,7 @@
  }
  
  sub gst_service_set_conf
-@@ -1632,6 +1811,47 @@
+@@ -1632,6 +1810,47 @@ sub gst_service_debian_get_status
    return undef;
  }
  
@@ -336,7 +335,7 @@
  sub gst_service_redhat_get_status
  {
    my ($service) = @_;
-@@ -1697,6 +1917,9 @@
+@@ -1697,6 +1916,9 @@ sub gst_service_get_status
         "ubuntu-5.04"  => \&gst_service_debian_get_status,
         "ubuntu-5.10"  => \&gst_service_debian_get_status,
         "ubuntu-6.04"  => \&gst_service_debian_get_status,
@@ -346,7 +345,7 @@
                
         "redhat-5.2"   => \&gst_service_redhat_get_status,
         "redhat-6.0"   => \&gst_service_redhat_get_status,
-@@ -1909,6 +2132,7 @@
+@@ -1909,6 +2131,7 @@ sub gst_service_run_script
         "rcng"    => \&gst_service_rcng_run_script,
         "suse"    => \&gst_service_sysv_run_initd_script,
         "archlinux" => \&gst_service_archlinux_run_script,
@@ -354,7 +353,7 @@
        );
  
    $type = &gst_get_init_type ();
-@@ -1964,6 +2188,14 @@
+@@ -1964,6 +2187,14 @@ sub gst_service_rcng_installed
    return 0;
  }
  
@@ -369,7 +368,7 @@
  sub gst_service_installed
  {
    my ($service) = @_;
-@@ -1975,6 +2207,8 @@
+@@ -1975,6 +2206,8 @@ sub gst_service_installed
    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");
@@ -378,7 +377,7 @@
    return 0;
  }
  
-@@ -2013,6 +2247,21 @@
+@@ -2013,6 +2246,21 @@ sub gst_service_bsd_set_status
    }
  }
  
@@ -400,10 +399,11 @@
  sub gst_service_gentoo_set_status
  {
    my ($script, $force_now, $active) = @_;
-diff -u system-tools-backends-1.4.2/service-list.pl.in-orig system-tools-backends-1.4.2/service-list.pl.in
---- system-tools-backends-1.4.2/service-list.pl.in-orig	2007-11-16 14:30:39.001316000 +0800
-+++ system-tools-backends-1.4.2/service-list.pl.in	2007-11-16 14:46:37.636436000 +0800
-@@ -82,7 +82,7 @@
+
+diff -up system-tools-backends-1.4.2/service-list.pl.in-clean system-tools-backends-1.4.2/service-list.pl.in
+--- system-tools-backends-1.4.2/service-list.pl.in-clean	2006-01-02 15:39:39.000000000 +0000
++++ system-tools-backends-1.4.2/service-list.pl.in	2008-03-05 14:00:30.285948000 +0000
+@@ -82,7 +82,7 @@ sub gst_service_list_service_is_forbidde
       "hostname",
       "keymaps",
       "localmount",
@@ -412,7 +412,7 @@
       "numlock",
       "depscan\.sh",
       "functions\.sh",
-@@ -145,6 +145,8 @@
+@@ -145,6 +145,8 @@ sub gst_service_list_service_is_forbidde
       "rc[sS0-9]\.d",
       "boot",
       "boot\..*",
@@ -421,3 +421,32 @@
      ];
  
    foreach $i (@$service_forbidden_list)
+@@ -328,10 +330,24 @@ sub gst_service_get_role
+     "zmailer" => "MTA",
+   );
+ 
+-  my ($role) = $service_roles{$script};
++  if ($gst_dist =~ /nexenta/ || $gst_dist =~ /solaris-2.11/) {
++    my $role;
+ 
+-  return $role if ($role);
+-  return "UNKNOWN";
++    foreach $key (keys %service_roles) {
++      if ( $script =~ /.*\b$key\b.*/ ) {
++        $role = $service_roles{$key}; 
++        last;
++      }
++    }
++    return $role if ($role);
++    return "UNKNOWN";
++  }
++  else {
++    my ($role) = $service_roles{$script};
++
++    return $role if ($role);
++    return "UNKNOWN";
++  }
+ }
+ 
+ 1;
+