summaryrefslogtreecommitdiff
path: root/extra/lm_sensors/changeset_lm-sensors_trunk_prog_detect_sensors-detect_r5964.diff
blob: eb3c591b9e4fc5ee73e42b80f3db594c91274250 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Index: lm-sensors/trunk/prog/detect/sensors-detect
===================================================================
--- lm-sensors/trunk/prog/detect/sensors-detect	(revision 5963)
+++ lm-sensors/trunk/prog/detect/sensors-detect	(revision 5964)
@@ -2416,5 +2416,5 @@
 		# Try some known default udev db locations, just in case
 		if (-e '/dev/.udev.tdb' || -e '/dev/.udev'
-		 || -e '/dev/.udevdb') {
+		 || -e '/dev/.udevdb' || -e '/run/udev') {
 			$use_udev = 1;
 			$dev_i2c = '/dev/i2c-';
@@ -6460,4 +6460,20 @@
 		close(SYSCONFIG);
 
+		if (-x "/bin/systemctl" && -d "/lib/systemd/system" &&
+		    ! -f "/lib/systemd/system/lm_sensors.service") {
+			print "Copy prog/init/lm_sensors.service to /lib/systemd/system\n".
+			      "and run 'systemctl enable lm_sensors.service'\n".
+			      "for initialization at boot time.\n";
+			return;
+		}
+
+		if (-x "/bin/systemctl" &&
+		    -f "/lib/systemd/system/lm_sensors.service") {
+			system("/bin/systemctl", "enable", "lm_sensors.service");
+			system("/bin/systemctl", "start", "lm_sensors.service");
+			# All done, don't check for /etc/init.d/lm_sensors
+			return;
+		}
+
 		print "Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors\n".
 		      "for initialization at boot time.\n"
@@ -6513,7 +6497,9 @@
 		exit -1;
 	}
 
-	if (-x "/sbin/service" && -f "/etc/rc.d/sensors" &&
-	    -f "/var/lock/subsys/lm_sensors") {
+       if (-x "/bin/systemctl" && -f "/lib/systemd/system/lm_sensors.service") {
+               system("/bin/systemctl", "stop", "lm_sensors.service");
+       } elsif (-x "/sbin/service" && -f "/etc/init.d/lm_sensors" &&
+                -f "/var/lock/subsys/lm_sensors") {
 		system("/sbin/service", "lm_sensors", "stop");
 	}