Compare commits
10 Commits
9e06804585
...
50e3a5fbb5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50e3a5fbb5 | ||
|
|
5ceaccf180 | ||
|
|
63ae510598 | ||
|
|
858836cfe2 | ||
|
|
3be4d784b7 | ||
|
|
26ecd50533 | ||
|
|
c74f7f3f01 | ||
|
|
fc611afd1a | ||
|
|
0b1460259c | ||
|
|
aa9db9a722 |
92
lm_sensors-3.6.0-allow_no_sensors.patch
Normal file
92
lm_sensors-3.6.0-allow_no_sensors.patch
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
diff --git a/prog/sensors/main.c b/prog/sensors/main.c
|
||||||
|
index f535b66..a19b919 100644
|
||||||
|
--- a/prog/sensors/main.c
|
||||||
|
+++ b/prog/sensors/main.c
|
||||||
|
@@ -54,15 +54,16 @@ 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"
|
||||||
|
- " -j Json 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"
|
||||||
|
+ " -j Json 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"
|
||||||
|
@@ -270,7 +271,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[] = {
|
||||||
|
@@ -281,6 +282,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 }
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -291,8 +293,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:uj", long_opts, NULL);
|
||||||
|
+ c = getopt_long(argc, argv, "hsvfAc:ujn", long_opts, NULL);
|
||||||
|
if (c == EOF)
|
||||||
|
break;
|
||||||
|
switch(c) {
|
||||||
|
@@ -327,6 +330,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");
|
||||||
|
@@ -349,7 +355,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 --git a/prog/sensors/sensors.1 b/prog/sensors/sensors.1
|
||||||
|
index 7d66e4b..d207aa1 100644
|
||||||
|
--- a/prog/sensors/sensors.1
|
||||||
|
+++ b/prog/sensors/sensors.1
|
||||||
|
@@ -78,6 +78,8 @@ are only needed if you have several chips sharing the same address on different
|
||||||
|
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
|
||||||
8
lm_sensors-wrapper
Executable file
8
lm_sensors-wrapper
Executable file
@ -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
|
||||||
@ -6,7 +6,7 @@ EnvironmentFile=/etc/sysconfig/lm_sensors
|
|||||||
Type=oneshot
|
Type=oneshot
|
||||||
RemainAfterExit=yes
|
RemainAfterExit=yes
|
||||||
ExecStart=-@WRAPPER_DIR@/lm_sensors-modprobe-wrapper $BUS_MODULES $HWMON_MODULES
|
ExecStart=-@WRAPPER_DIR@/lm_sensors-modprobe-wrapper $BUS_MODULES $HWMON_MODULES
|
||||||
ExecStart=/usr/bin/sensors -s
|
ExecStart=@WRAPPER_DIR@/lm_sensors-wrapper
|
||||||
ExecStop=-@WRAPPER_DIR@/lm_sensors-modprobe-r-wrapper $BUS_MODULES $HWMON_MODULES
|
ExecStop=-@WRAPPER_DIR@/lm_sensors-modprobe-r-wrapper $BUS_MODULES $HWMON_MODULES
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Name: lm_sensors
|
Name: lm_sensors
|
||||||
Version: 3.6.0
|
Version: 3.6.0
|
||||||
Release: 3
|
Release: 8
|
||||||
Summary: Linux-monitoring sensors
|
Summary: Linux-monitoring sensors
|
||||||
# lib/libsensors.3 is licensed Verbatim
|
# lib/libsensors.3 is licensed Verbatim
|
||||||
# dist-git files are licensed MIT
|
# dist-git files are licensed MIT
|
||||||
@ -11,7 +11,7 @@ License: LGPLv2+ and GPLv2+ and Verbatim and MIT
|
|||||||
URL: http://github.com/lm-sensors/lm-sensors
|
URL: http://github.com/lm-sensors/lm-sensors
|
||||||
|
|
||||||
#from https://github.com/lm-sensors/lm-sensors/archive/V%{git_version}/lm-sensors-%{git_version}.tar.gz
|
#from https://github.com/lm-sensors/lm-sensors/archive/V%{git_version}/lm-sensors-%{git_version}.tar.gz
|
||||||
Source0: lm-sensors-%{git_version}.tar.gz
|
Source0: https://github.com/lm-sensors/lm-sensors/archive/V%{git_version}/lm-sensors-%{git_version}.tar.gz
|
||||||
Source1: lm_sensors.sysconfig
|
Source1: lm_sensors.sysconfig
|
||||||
Source2: sensord.sysconfig
|
Source2: sensord.sysconfig
|
||||||
Source3: lm_sensors-modprobe-wrapper
|
Source3: lm_sensors-modprobe-wrapper
|
||||||
@ -19,6 +19,10 @@ Source4: lm_sensors-modprobe-r-wrapper
|
|||||||
Source5: sensord.service
|
Source5: sensord.service
|
||||||
Source6: sensord-service-wrapper
|
Source6: sensord-service-wrapper
|
||||||
Source7: lm_sensors.service
|
Source7: lm_sensors.service
|
||||||
|
Source8: lm_sensors-wrapper
|
||||||
|
|
||||||
|
#Upstream patch for fixing no sensors failure in vm
|
||||||
|
Patch0: lm_sensors-3.6.0-allow_no_sensors.patch
|
||||||
|
|
||||||
Requires: kmod, systemd-units
|
Requires: kmod, systemd-units
|
||||||
BuildRequires: kernel-headers >= 2.2.16, bison, libsysfs-devel, flex, gawk
|
BuildRequires: kernel-headers >= 2.2.16, bison, libsysfs-devel, flex, gawk
|
||||||
@ -72,6 +76,8 @@ cp -p %{SOURCE7} lm_sensors.service
|
|||||||
sed -i "s|\@WRAPPER_DIR\@|%{_libexecdir}/%{name}|" sensord.service
|
sed -i "s|\@WRAPPER_DIR\@|%{_libexecdir}/%{name}|" sensord.service
|
||||||
sed -i "s|\@WRAPPER_DIR\@|%{_libexecdir}/%{name}|" lm_sensors.service
|
sed -i "s|\@WRAPPER_DIR\@|%{_libexecdir}/%{name}|" lm_sensors.service
|
||||||
|
|
||||||
|
sed -i 's|CC := gcc|CC ?= gcc|' Makefile
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%set_build_flags
|
%set_build_flags
|
||||||
%make_build PREFIX=%{_prefix} LIBDIR=%{_libdir} MANDIR=%{_mandir} \
|
%make_build PREFIX=%{_prefix} LIBDIR=%{_libdir} MANDIR=%{_mandir} \
|
||||||
@ -99,6 +105,7 @@ install -pm 644 sensord.service $RPM_BUILD_ROOT%{_unitdir}
|
|||||||
mkdir -p $RPM_BUILD_ROOT%{_libexecdir}/%{name}
|
mkdir -p $RPM_BUILD_ROOT%{_libexecdir}/%{name}
|
||||||
install -pm 755 %{SOURCE3} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/lm_sensors-modprobe-wrapper
|
install -pm 755 %{SOURCE3} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/lm_sensors-modprobe-wrapper
|
||||||
install -pm 755 %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/lm_sensors-modprobe-r-wrapper
|
install -pm 755 %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/lm_sensors-modprobe-r-wrapper
|
||||||
|
install -pm 755 %{SOURCE8} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/lm_sensors-wrapper
|
||||||
|
|
||||||
# sensord service wrapper
|
# sensord service wrapper
|
||||||
install -pm 755 %{SOURCE6} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/sensord-service-wrapper
|
install -pm 755 %{SOURCE6} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/sensord-service-wrapper
|
||||||
@ -120,12 +127,12 @@ fi
|
|||||||
%systemd_postun_with_restart lm_sensors.service
|
%systemd_postun_with_restart lm_sensors.service
|
||||||
|
|
||||||
# ==== sensord ===
|
# ==== sensord ===
|
||||||
#%post sensord
|
%post sensord
|
||||||
#%systemd_post sensord.service
|
%systemd_post sensord.service
|
||||||
#%preun sensord
|
%preun sensord
|
||||||
#%systemd_preun sensord.service
|
%systemd_preun sensord.service
|
||||||
#%postun sensord
|
%postun sensord
|
||||||
#%systemd_postun_with_restart sensord.service
|
%systemd_postun_with_restart sensord.service
|
||||||
|
|
||||||
# ===== libs =====
|
# ===== libs =====
|
||||||
%ldconfig_scriptlets
|
%ldconfig_scriptlets
|
||||||
@ -143,6 +150,7 @@ fi
|
|||||||
%{_unitdir}/fancontrol.service
|
%{_unitdir}/fancontrol.service
|
||||||
%dir %{_libexecdir}/%{name}
|
%dir %{_libexecdir}/%{name}
|
||||||
%{_libexecdir}/%{name}/lm_sensors-modprobe*wrapper
|
%{_libexecdir}/%{name}/lm_sensors-modprobe*wrapper
|
||||||
|
%{_libexecdir}/%{name}/lm_sensors-wrapper
|
||||||
%{_libdir}/*.so.*
|
%{_libdir}/*.so.*
|
||||||
%exclude %{_sbindir}/sensord
|
%exclude %{_sbindir}/sensord
|
||||||
|
|
||||||
@ -162,6 +170,21 @@ fi
|
|||||||
%exclude %{_mandir}/man8/sensord.8.gz
|
%exclude %{_mandir}/man8/sensord.8.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Nov 08 2023 konglidong <konglidong@uniontech.com> - 3.6.0-8
|
||||||
|
- amend fix no sensors failure in vm
|
||||||
|
|
||||||
|
* Mon Sep 11 2023 wangxiaomeng <wangxiaomeng@kylinos.cn> - 3.6.0-7
|
||||||
|
- backport upstraem patch to fix no sensors failure in vm
|
||||||
|
|
||||||
|
* Sun Apr 23 2023 liweiganga <liweiganga@uniontech.com> - 3.6.0-6
|
||||||
|
- add llvm compile support
|
||||||
|
|
||||||
|
* Sat Sep 19 2020 xinghe <xinghe1@huawei.com> - 3.6.0-5
|
||||||
|
- fix uninstall failure
|
||||||
|
|
||||||
|
* Fri Sep 04 2020 xinghe <xinghe1@huawei.com> - 3.6.0-4
|
||||||
|
- fix source0 download
|
||||||
|
|
||||||
* Fri May 29 2020 Chunsheng Luo <luochunsheng@huawei.com> - 3.6.0-3
|
* Fri May 29 2020 Chunsheng Luo <luochunsheng@huawei.com> - 3.6.0-3
|
||||||
- delete "Include previous ABI version for temporary binary compatibility"
|
- delete "Include previous ABI version for temporary binary compatibility"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user