From f5f5213501151d169e09503b7fa824286c9a33ea Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 18 2024 19:56:54 +0000 Subject: import lm_sensors-3.4.0-8.20160601gitf9185e5.el7_9.1 --- diff --git a/SOURCES/lm_sensors-3.4.0-allow_no_sensors.patch b/SOURCES/lm_sensors-3.4.0-allow_no_sensors.patch new file mode 100644 index 0000000..21ea178 --- /dev/null +++ b/SOURCES/lm_sensors-3.4.0-allow_no_sensors.patch @@ -0,0 +1,100 @@ +diff -Nupur a/prog/sensors/main.c b/prog/sensors/main.c +--- a/prog/sensors/main.c 2015-06-25 04:24:47.000000000 -0700 ++++ b/prog/sensors/main.c 2023-12-10 14:33:48.636986764 -0800 +@@ -54,14 +54,15 @@ static void print_short_help(void) + static void print_long_help(void) + { + printf("Usage: %s [OPTION]... [CHIP]...\n", PROGRAM); +- puts(" -c, --config-file Specify a config file\n" +- " -h, --help Display this help text\n" +- " -s, --set Execute `set' statements (root only)\n" +- " -f, --fahrenheit Show temperatures in degrees fahrenheit\n" +- " -A, --no-adapter Do not show adapter for each chip\n" +- " --bus-list Generate bus statements for sensors.conf\n" +- " -u Raw output\n" +- " -v, --version Display the program version\n" ++ puts(" -c, --config-file Specify a config file\n" ++ " -h, --help Display this help text\n" ++ " -s, --set Execute `set' statements (root only)\n" ++ " -f, --fahrenheit Show temperatures in degrees fahrenheit\n" ++ " -A, --no-adapter Do not show adapter for each chip\n" ++ " --bus-list Generate bus statements for sensors.conf\n" ++ " -u Raw output\n" ++ " -v, --version Display the program version\n" ++ " -n, --allow-no-sensors Do not fail if no sensors found\n" + "\n" + "Use `-' after `-c' to read the config file from stdin.\n" + "If no chips are specified, all chip info will be printed.\n" +@@ -244,7 +245,7 @@ static void print_bus_list(void) + + int main(int argc, char *argv[]) + { +- int c, i, err, do_bus_list; ++ int c, i, err, do_bus_list, allow_no_sensors; + const char *config_file_name = NULL; + + struct option long_opts[] = { +@@ -255,6 +256,7 @@ int main(int argc, char *argv[]) + { "no-adapter", no_argument, NULL, 'A' }, + { "config-file", required_argument, NULL, 'c' }, + { "bus-list", no_argument, NULL, 'B' }, ++ { "allow-no-sensors", no_argument, NULL, 'n' }, + { 0, 0, 0, 0 } + }; + +@@ -264,8 +266,9 @@ int main(int argc, char *argv[]) + do_sets = 0; + do_bus_list = 0; + hide_adapter = 0; ++ allow_no_sensors = 0; + while (1) { +- c = getopt_long(argc, argv, "hsvfAc:u", long_opts, NULL); ++ c = getopt_long(argc, argv, "hsvfAc:un", long_opts, NULL); + if (c == EOF) + break; + switch(c) { +@@ -297,6 +300,9 @@ int main(int argc, char *argv[]) + case 'B': + do_bus_list = 1; + break; ++ case 'n': ++ allow_no_sensors = 1; ++ break; + default: + fprintf(stderr, + "Internal error while parsing options!\n"); +@@ -319,7 +325,9 @@ int main(int argc, char *argv[]) + "No sensors found!\n" + "Make sure you loaded all the kernel drivers you need.\n" + "Try sensors-detect to find out which these are.\n"); +- err = 1; ++ if (!allow_no_sensors) { ++ err = 1; ++ } + } + } else { + int cnt = 0; +diff -Nupur a/prog/sensors/sensors.1 b/prog/sensors/sensors.1 +--- a/prog/sensors/sensors.1 2023-12-10 14:20:37.394096995 -0800 ++++ b/prog/sensors/sensors.1 2023-12-10 14:24:52.572369778 -0800 +@@ -76,6 +76,8 @@ are only needed if you have several chip + buses of the same type. As bus numbers are usually not guaranteed to be stable + over reboots, these statements let you refer to each bus by its name rather + than numbers. ++.IP "-n, --allow-no-sensors" ++Do not fail if no sensors found. The error message will be printed in the log. + .SH FILES + .I /etc/sensors3.conf + .br +diff -Nupur a/prog/init/lm_sensors.service b/prog/init/lm_sensors.service +--- a/prog/init/lm_sensors.service 2023-12-10 14:20:37.361096957 -0800 ++++ b/prog/init/lm_sensors.service 2023-12-10 15:05:51.150333299 -0800 +@@ -6,7 +6,7 @@ EnvironmentFile=/etc/sysconfig/lm_sensor + Type=oneshot + RemainAfterExit=yes + ExecStart=-/usr/libexec/lm_sensors/modprobe $BUS_MODULES $HWMON_MODULES +-ExecStart=/usr/bin/sensors -s ++ExecStart=/usr/libexec/lm_sensors/lm_sensors-wrapper + ExecStop=-/usr/libexec/lm_sensors/modprobe-r $BUS_MODULES $HWMON_MODULES + + [Install] diff --git a/SOURCES/lm_sensors-wrapper b/SOURCES/lm_sensors-wrapper new file mode 100644 index 0000000..8eb32a4 --- /dev/null +++ b/SOURCES/lm_sensors-wrapper @@ -0,0 +1,8 @@ +#!/bin/sh +if /usr/bin/systemd-detect-virt 2>/dev/null 1>&2; then + SENSORS_FLAGS_VM='-n'; +else + SENSORS_FLAGS_VM=''; +fi; + +/usr/bin/sensors -s $SENSORS_FLAGS_VM diff --git a/SPECS/lm_sensors.spec b/SPECS/lm_sensors.spec index 8f6ee3d..d1f5c3f 100644 --- a/SPECS/lm_sensors.spec +++ b/SPECS/lm_sensors.spec @@ -7,7 +7,7 @@ Name: lm_sensors Version: 3.4.0 -Release: 8.%{date}git%{shortcommit}%{?dist} +Release: 8.%{date}git%{shortcommit}%{?dist}.1 Summary: Hardware monitoring tools Group: Applications/System License: LGPLv2+ and GPLv3+ and GPLv2+ and Verbatim and Public Domain @@ -23,6 +23,7 @@ Source1: lm_sensors.sysconfig Source2: sensord.sysconfig Source3: lm_sensors-modprobe Source4: lm_sensors-modprobe-r +Source5: lm_sensors-wrapper Patch0: lm_sensors-3.3.4-lm_sensors-service-modprobe-warnings.patch Patch1: lm_sensors-3.4.0-fix-systemd-paths.patch @@ -41,6 +42,9 @@ Patch7: 0001-sensors-detect-Add-detection-of-AMD-Family-17h-model.patch # sensors.conf.default is downstream-only, but can be dropped if lm_sensors # is rebased to 3.5.0 or later. Patch8: 0001-Fix-stale-links-and-outdated-info.patch +# Backport from upstream a0ef84f6583dbf427ff5a3534528e1e72bd00137 +# Added patch to prog/init/lm_sensors.service to use lm_sensors-wrapper +Patch9: lm_sensors-3.4.0-allow_no_sensors.patch %ifarch %{ix86} x86_64 Requires: /usr/sbin/dmidecode @@ -95,6 +99,7 @@ database, and warns of sensor alarms. %patch6 -p1 %patch7 -p1 %patch8 -p1 +%patch9 -p1 mv prog/init/README prog/init/README.initscripts chmod -x prog/init/fancontrol.init @@ -135,6 +140,7 @@ install -pm 644 prog/init/fancontrol.service $RPM_BUILD_ROOT%{_unitdir} mkdir -p $RPM_BUILD_ROOT%{_libexecdir}/%{name} install -pm 755 %{SOURCE3} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/modprobe install -pm 755 %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/modprobe-r +install -pm 755 %{SOURCE5} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/lm_sensors-wrapper # Note non standard systemd scriptlets, since reload / stop makes no sense @@ -185,6 +191,7 @@ fi %{_unitdir}/lm_sensors.service %{_unitdir}/fancontrol.service %{_libexecdir}/%{name}/modprobe* +%{_libexecdir}/%{name}/lm_sensors-wrapper %config(noreplace) %{_sysconfdir}/sysconfig/lm_sensors %exclude %{_sbindir}/sensord %exclude %{_mandir}/man8/sensord.8.gz @@ -206,6 +213,11 @@ fi %changelog +* Sun Dec 10 2023 Bryan Mason - 3.4.0-8.20160601gitf9185e5.el7_9.1 +- New flag for no sensors added. This flag is used in VM environment + to make sensors binaries not fail if no sensors was detected. +- Resolves: RHEL-17699 + * Wed Mar 27 2019 Ondřej Lysoněk - 3.4.0-8.20160601gitf9185e5 - Fixed stale links and outdated info - Resolves: rhbz#1356253