[liboobs] Don't allow OOBS_SERVICE_IGNORE status for an init script



commit bdb3f2fb90d5c7287d4bf58f0bac731a9a554358
Author: Milan Bouchet-Valat <nalimilan club fr>
Date:   Sun Sep 27 19:40:40 2009 +0200

    Don't allow OOBS_SERVICE_IGNORE status for an init script
    
    This status was handled internally as "remove from list", which in turn made the backends remove all symlinks in /etc/rcN.d/ for that script and runlevel. This is not the recommended way since upgrade of the package will re-enable the script automatically. Clients must use OOBS_SERVICE_STOP instead.

 oobs/oobs-service.c |   25 ++++++++++---------------
 oobs/oobs-service.h |    1 +
 2 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/oobs/oobs-service.c b/oobs/oobs-service.c
index 238b785..fb9dca3 100644
--- a/oobs/oobs-service.c
+++ b/oobs/oobs-service.c
@@ -196,22 +196,17 @@ oobs_service_set_runlevel_configuration (OobsService          *service,
 
   priv = service->_priv;
 
-  if (status == OOBS_SERVICE_IGNORE)
-    g_hash_table_remove (priv->runlevels_config, runlevel);
-  else
-    {
-      service_runlevel = g_hash_table_lookup (priv->runlevels_config, runlevel);
-
-      if (!service_runlevel)
-	{
-	  service_runlevel = g_new0 (OobsServiceRunlevel, 1);
-	  g_hash_table_insert (priv->runlevels_config,
-			       runlevel, service_runlevel);
-	}
+  service_runlevel = g_hash_table_lookup (priv->runlevels_config, runlevel);
 
-      service_runlevel->status = status;
-      service_runlevel->priority = priority;
+  if (!service_runlevel)
+    {
+      service_runlevel = g_new0 (OobsServiceRunlevel, 1);
+      g_hash_table_insert (priv->runlevels_config,
+                           runlevel, service_runlevel);
     }
+
+  service_runlevel->status = status;
+  service_runlevel->priority = priority;
 }
 
 /**
@@ -240,7 +235,7 @@ oobs_service_get_runlevel_configuration (OobsService          *service,
   service_runlevel = g_hash_table_lookup (priv->runlevels_config, runlevel);
 
   if (status)
-    *status = (service_runlevel) ? service_runlevel->status : OOBS_SERVICE_IGNORE;
+    *status = (service_runlevel) ? service_runlevel->status : OOBS_SERVICE_STOP;
 
   if (priority)
     *priority = (service_runlevel) ? service_runlevel->priority : -1;
diff --git a/oobs/oobs-service.h b/oobs/oobs-service.h
index 9db2472..fc1728d 100644
--- a/oobs/oobs-service.h
+++ b/oobs/oobs-service.h
@@ -40,6 +40,7 @@ typedef enum
 {
   OOBS_SERVICE_START,
   OOBS_SERVICE_STOP,
+  /* For services not listed in that runlevel */
   OOBS_SERVICE_IGNORE
 } OobsServiceStatus;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]