- lm_sensors-3.4.0-sensors-detect-fix-systemd-path.patch: Handle

the move of systemd from / to /usr.

OBS-URL: https://build.opensuse.org/package/show/Base:System/sensors?expand=0&rev=86
This commit is contained in:
Jean Delvare 2015-07-02 09:22:49 +00:00 committed by Git OBS Bridge
parent ce8a57b385
commit 8bd2e600b1
3 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,100 @@
From: Jean Delvare <jdelvare@suse.de>
Subject: sensors-detect: Fix systemd paths
Upstream: submitted 2015-07-02
Most systems have moved systemd from / to /usr, so sensors-detect
should check for the latter too (and first.)
---
prog/detect/sensors-detect | 53 +++++++++++++++++++++++++++------------------
1 file changed, 32 insertions(+), 21 deletions(-)
--- a/prog/detect/sensors-detect
+++ b/prog/detect/sensors-detect
@@ -2728,7 +2728,7 @@ sub isa_read_i5d6
# AUTODETECTION #
#################
-use vars qw($dev_i2c $sysfs_root);
+use vars qw($dev_i2c $sysfs_root $systemd_systemctl $systemd_system_dir);
sub initialize_conf
{
@@ -2789,6 +2789,19 @@ sub initialize_conf
exit -1;
}
}
+
+ # Detect systemd presence and paths
+ if (-x "/usr/bin/systemctl") {
+ $systemd_systemctl = "/usr/bin/systemctl";
+ } elsif (-x "/bin/systemctl") {
+ $systemd_systemctl = "/bin/systemctl";
+ }
+
+ if (-d "/usr/lib/systemd/system") {
+ $systemd_system_dir = "/usr/lib/systemd/system";
+ } elsif (-d "/lib/systemd/system") {
+ $systemd_system_dir = "/lib/systemd/system";
+ }
}
# [0] -> VERSION
@@ -7101,19 +7114,16 @@ EOT
print SYSCONFIG "HWMON_MODULES=\"", join(" ", @{$hwmon_modules}), "\"\n";
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
+ if ($systemd_systemctl && $systemd_system_dir) {
+ if (-f "$systemd_system_dir/lm_sensors.service") {
+ system($systemd_systemctl, "enable", "lm_sensors.service");
+ system($systemd_systemctl, "start", "lm_sensors.service");
+ # All done, don't check for /etc/init.d/lm_sensors
+ } else {
+ print "Copy prog/init/lm_sensors.service to $systemd_system_dir\n".
+ "and run 'systemctl enable lm_sensors.service'\n".
+ "for initialization at boot time.\n";
+ }
return;
}
@@ -7181,13 +7191,6 @@ sub main
exit -1;
}
- 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");
- }
-
initialize_kernel_version();
initialize_conf();
initialize_pci();
@@ -7198,6 +7201,14 @@ sub main
initialize_modules_supported();
initialize_cpu_list();
+ if ($systemd_systemctl && $systemd_system_dir &&
+ -f "$systemd_system_dir/lm_sensors.service") {
+ system("$systemd_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");
+ }
+
print "# sensors-detect revision $revision\n";
initialize_dmi_data();
print_dmi_summary();

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Jul 2 10:55:58 CEST 2015 - jdelvare@suse.com
- lm_sensors-3.4.0-sensors-detect-fix-systemd-path.patch: Handle
the move of systemd from / to /usr.
-------------------------------------------------------------------
Tue Jun 30 13:08:50 CEST 2015 - jdelvare@suse.com

View File

@ -36,6 +36,7 @@ Patch1: lm_sensors-3.1.1-build.patch
Patch2: lm_sensors-3.0.0-sensord-separate.patch
Patch3: lm_sensors-3.0.0-sysconfig_metadata.patch
Patch4: lm_sensors-3.0.3-hint-at-kernel-extra-package.patch
Patch5: lm_sensors-3.4.0-sensors-detect-fix-systemd-path.patch
ExcludeArch: s390 s390x
%{?systemd_requires}
@ -97,6 +98,7 @@ sense to the user.
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
RPM_OPT_FLAGS="$RPM_OPT_FLAGS"