PATCH: systemd integration version 2
Hi,
The attached patch:
1) uses systemd's systemctl to start / stop / enable the lm_sensors service on systemd systems (such as Fedora 15)
2) recognizes the new /run dir for run time info (as used by systemd systems) as a possible place where the udev db can live
3) adds a lm_sensor.service file to install under /lib/systemd/system
Version 2:
1) adds detection that the lm_sensor.service still needs to be installed under /lib/systemd/system to sensors-detect
2) has a better description for the .service file
Please review, I'll push it to svn myself once acked.
Regards,
Hans
init/lm_sensors.service +14 -0
@@ -0,0 +1,14 @@ +[Unit] +Description=Initialize hardware monitoring sensors +After=syslog.target + +[Service] +EnvironmentFile=/etc/sysconfig/lm_sensors +Type=oneshot +RemainAfterExit=yes +ExecStart=-/sbin/modprobe -qab $BUS_MODULES $HWMON_MODULES +ExecStart=/usr/bin/sensors -s +ExecStop=-/sbin/modprobe -qabr $BUS_MODULES $HWMON_MODULES + +[Install] +WantedBy=multi-user.target
detect/sensors-detect +21 -3
@@ -2339,7 +2339,7 @@ if (!$use_udev) { # 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-'; }
@@ -6378,6 +6378,22 @@ } 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" unless -f "/etc/init.d/lm_sensors";
@@ -6433,8 +6449,10 @@ exit -1; } - if (-x "/sbin/service" && -f "/etc/init.d/lm_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"); }
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Hans,
Quoted 9 lines · Hans de Goede
Hi,
The attached patch:
1) uses systemd's systemctl to start / stop / enable thelm_sensorsservice on systemd systems (such as Fedora 15)
2) recognizes the new /run dir for run time info (as used by systemd systems) as a possible place where the udev db can live
3) adds a lm_sensor.service file to install under/lib/systemd/system
Quoted 6 lines
Version 2:
1) adds detection that the lm_sensor.service still needs to be installed under/lib/systemd/systemto sensors-detect
2) has a better description for the .service filePlease review, I'll push it to svn myself once acked.
One thing:
detect/sensors-detect line 6384
Quoted 4 lines
detect/sensors-detect +4
-0+ 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".
Should be "and" not "And". Might be good to have quotes around the suggested commands too, for clarity. Other than this, you have my ack, please go ahead and commit. Please don't forget to mention the change in file CHANGES.
Quoted 3 lines
detect/sensors-detect +3
-0+ "for initialization at boot time.\n"; + return; + }
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors