Skip to contentSkip to conversation

Patch: don't start initscript by default on chkconfig

lm-sensors Hans de Goede 2 participants 3 messages Feb 11, 2008 – Feb 26, 2008

lore
Share & tools
lore
#0 lore raw

Hi All,

The attached patch modifies the initscript included with lm_sensors so that it doesn't start by default on chkconfig using systems.

The patch also modifies sensors-detect to activate the initscript once lm_sensors has been successfully configured.

If I don't get any objections I will be committing this to svn in a couple of days.

Regards,

Hans

prog/detect/sensors-detect renamed from prog/detect/sensors-detect.foo +9 -0
diff -up lm_sensors-3.0.1/prog/detect/sensors-detect.foo lm_sensors-3.0.1/prog/detect/sensors-detect
@@ -5943,6 +5943,15 @@ EOT
 
     if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") {
       system("/sbin/insserv", "/etc/init.d/lm_sensors");
+    } elsif (-x "/sbin/chkconfig" && -f "/etc/init.d/lm_sensors") {
+      system("/sbin/chkconfig", "lm_sensors", "on");
+      if (-x "/sbin/service") {
+        if (-f "/var/lock/subsys/lm_sensors") {
+          system("/sbin/service", "lm_sensors", "restart");
+        } else {
+          system("/sbin/service", "lm_sensors", "start");
+        }
+      }
     } else {
       print "You should now start the lm_sensors service to load the required\n".
             "kernel modules.\n\n";
prog/init/lm_sensors.init renamed from prog/init/lm_sensors.init.foo +1 -1
diff -up lm_sensors-3.0.1/prog/init/lm_sensors.init.foo lm_sensors-3.0.1/prog/init/lm_sensors.init
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# chkconfig: 2345 26 74
+# chkconfig: - 26 74
 # description: sensors is used for monitoring motherboard sensor values.
 # config: /etc/sysconfig/lm_sensors
 #

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw

Re: [lm-sensors] Patch: don't start initscript by default on

Hi Hans,

Quoted 7 lines · Hans de Goede

The attached patch modifies the initscript included with lm_sensors so that it doesn't start by default on chkconfig using systems.

The patch also modifies sensors-detect to activate the initscript once lm_sensors has been successfully configured.

If I don't get any objections I will be committing this to svn in a couple of days.

Overall I am fine with this change (it doesn't affect openSuse.)

Quoted 5 lines

diff -up lm_sensors-3.0.1/prog/detect/sensors-detect.foo lm_sensors-3.0.1/prog/detect/sensors-detect

prog/detect/sensors-detect renamed from prog/detect/sensors-detect.foo +0 -0
@@ -5943,6 +5943,15 @@ EOT
 

prog/detect/sensors-detect EOT · line 5953

Quoted 10 lines
prog/detect/sensors-detect renamed from prog/detect/sensors-detect.foo +8 -0
     if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") {
       system("/sbin/insserv", "/etc/init.d/lm_sensors");
+    } elsif (-x "/sbin/chkconfig" && -f "/etc/init.d/lm_sensors") {
+      system("/sbin/chkconfig", "lm_sensors", "on");
+      if (-x "/sbin/service") {
+        if (-f "/var/lock/subsys/lm_sensors") {
+          system("/sbin/service", "lm_sensors", "restart");
+        } else {
+          system("/sbin/service", "lm_sensors", "start");
+        }

My only worry is to see the lock file name "leak" to sensors-detect. I'd prefer it to be only mentioned in the initialization script itself... Is there any problem to calling "restart" unconditionally? Or maybe even better, shouldn't we call "stop" at the beginning of sensors-detect? Probing for devices while the hwmon drivers are loaded has side effects we probably want to avoid anyway.

Quoted 15 lines
prog/detect/sensors-detect renamed from prog/detect/sensors-detect.foo +1 -0
+      }
     } else {
       print "You should now start the lm_sensors service to load the required\n".
             "kernel modules.\n\n";

diff -up lm_sensors-3.0.1/prog/init/lm_sensors.init.foo lm_sensors-3.0.1/prog/init/lm_sensors.init

prog/init/lm_sensors.init renamed from prog/init/lm_sensors.init.foo +1 -1
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# chkconfig: 2345 26 74
+# chkconfig: - 26 74
 # description: sensors is used for monitoring motherboard sensor values.
 # config: /etc/sysconfig/lm_sensors
 #
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw

Re: [lm-sensors] Patch: don't start initscript by default on

In reply to Hans de Goede
Quoted 25 lines · Jean Delvare

Hi Hans,

Quoted 5 lines · Hans de Goede

The attached patch modifies the initscript included with lm_sensors so that it doesn't start by default on chkconfig using systems.

The patch also modifies sensors-detect to activate the initscript once lm_sensors has been successfully configured.

If I don't get any objections I will be committing this to svn in a couple of days.

Overall I am fine with this change (it doesn't affect openSuse.)

Quoted 14 lines

diff -up lm_sensors-3.0.1/prog/detect/sensors-detect.foo lm_sensors-3.0.1/prog/detect/sensors-detect

prog/detect/sensors-detect renamed from prog/detect/sensors-detect.foo +7 -0
@@ -5943,6 +5943,15 @@ EOT
 
     if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") {
       system("/sbin/insserv", "/etc/init.d/lm_sensors");
+    } elsif (-x "/sbin/chkconfig" && -f "/etc/init.d/lm_sensors") {
+      system("/sbin/chkconfig", "lm_sensors", "on");
+      if (-x "/sbin/service") {
+        if (-f "/var/lock/subsys/lm_sensors") {
+          system("/sbin/service", "lm_sensors", "restart");
+        } else {
+          system("/sbin/service", "lm_sensors", "start");
Quoted 9 lines

prog/detect/sensors-detect EOT · line 5953

Quoted 1 line
prog/detect/sensors-detect renamed from prog/detect/sensors-detect.foo +1 -0
+        }

My only worry is to see the lock file name "leak" to sensors-detect. I'd prefer it to be only mentioned in the initialization script itself... Is there any problem to calling "restart" unconditionally? Or maybe even better, shouldn't we call "stop" at the beginning of sensors-detect? Probing for devices while the hwmon drivers are loaded has side effects we probably want to avoid anyway.

Calling stop at the start of sensors-detect is a good idea, new version attached. This once again shouldn't effect any non RedHat derived distro's, but still a quick review would be a good idea I think.

Regards,

Hans

prog/init/lm_sensors.init renamed from prog/init/lm_sensors.init.default-off +1 -1
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# chkconfig: 2345 26 74
+# chkconfig: - 26 74
 # description: sensors is used for monitoring motherboard sensor values.
 # config: /etc/sysconfig/lm_sensors
 #
prog/detect/sensors-detect renamed from prog/detect/sensors-detect.default-off +10 -0
@@ -5673,6 +5673,11 @@ sub main
     exit -1;
   }
 
+  if (-x "/sbin/service" && -f "/etc/init.d/lm_sensors" &&
+      -f "/var/lock/subsys/lm_sensors") {
+    system("/sbin/service", "lm_sensors", "stop");
+  }
+
   initialize_kernel_version();
   initialize_conf;
   initialize_proc_pci;
@@ -5943,6 +5948,11 @@ EOT
 
     if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") {
       system("/sbin/insserv", "/etc/init.d/lm_sensors");
+    } elsif (-x "/sbin/chkconfig" && -f "/etc/init.d/lm_sensors") {
+      system("/sbin/chkconfig", "lm_sensors", "on");
+      if (-x "/sbin/service") {
+        system("/sbin/service", "lm_sensors", "start");
+      }
     } else {
       print "You should now start the lm_sensors service to load the required\n".
             "kernel modules.\n\n";

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors