sensors-detect: added patch to correctly detect kernel version

switch to systemd support [release 3.3.5-2mamba;Tue Jun 10 2014]
This commit is contained in:
Silvan Calarco 2024-01-06 06:27:01 +01:00
parent 0e56c6bfa6
commit 90e2961817
3 changed files with 70 additions and 34 deletions

View File

@ -1,13 +0,0 @@
diff -Nru lm_sensors-3.3.1.orig/prog/detect/sensors-detect lm_sensors-3.3.1/prog/detect/sensors-detect
--- lm_sensors-3.3.1.orig/prog/detect/sensors-detect 2011-07-10 21:22:53.000000000 +0200
+++ lm_sensors-3.3.1/prog/detect/sensors-detect 2012-01-06 16:41:53.139801191 +0100
@@ -2472,7 +2472,8 @@
sub initialize_kernel_version
{
- `uname -r` =~ /(\d+)\.(\d+)\.(\d+)(.*)/;
+ #Third decimal only for point releases starting with 3.0
+ `uname -r` =~ /(\d+)\.(\d+)(\.(\d+))?(.*)/;
@kernel_version = ($1, $2, $3, $4);
chomp($kernel_arch = `uname -m`);

View File

@ -0,0 +1,14 @@
diff -Nru lm_sensors-3.3.5.orig/prog/detect/sensors-detect lm_sensors-3.3.5/prog/detect/sensors-detect
--- lm_sensors-3.3.5.orig/prog/detect/sensors-detect 2014-01-14 22:51:58.615935000 +0100
+++ lm_sensors-3.3.5/prog/detect/sensors-detect 2014-06-10 14:29:27.202205868 +0200
@@ -2674,8 +2674,8 @@
sub initialize_kernel_version
{
chomp($kernel_version = `uname -r`);
- $kernel_version =~ /(\d+)\.(\d+)\.(\d+)(.*)/;
- @kernel_version = ($1, $2, $3, $4);
+ $kernel_version =~ /(\d+)\.(\d+)(.*)/;
+ @kernel_version = ($1, $2, $3);
chomp($kernel_arch = `uname -m`);
# We only support kernels >= 2.6.5

View File

@ -1,6 +1,6 @@
Name: lm_sensors
Version: 3.3.5
Release: 1mamba
Release: 2mamba
Summary: Tools for monitoring the hardware health of Linux systems
Group: System/Kernel and Hardware
Vendor: openmamba
@ -8,14 +8,17 @@ Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.lm-sensors.org/
Source: http://dl.lm-sensors.org/lm-sensors/releases/lm_sensors-%{version}.tar.bz2
Patch: %{name}-3.3.1-kernel-3.0.patch
Patch0: lm_sensors-3.3.5-kernel-detect-openmamba.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libperl
BuildRequires: perl-devel
## AUTOBUILDREQ-END
BuildRequires: libsystemd-devel
BuildRequires: libsysfs-devel >= 2.0.0
BuildRequires: flex
Requires(post): systemd-core
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
%description
@ -33,7 +36,7 @@ This package contains static libraries and header files need for development.
%prep
%setup -q
#%patch0 -p1
%patch0 -p1
%build
%make user PREFIX=%{_prefix} MANDIR=%{_mandir} LIBDIR=%{_libdir}
@ -42,16 +45,12 @@ This package contains static libraries and header files need for development.
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
make user_install MANDIR=%{_mandir} PREFIX=%{_prefix} DESTDIR=%{buildroot} LIBDIR=%{_libdir}
install -D -m 0755 prog/init/fancontrol.init %{buildroot}%{_initrddir}/fancontrol
install -D -m 0755 prog/init/lm_sensors.init %{buildroot}%{_initrddir}/lm_sensors
#install -D -m 0755 prog/init/sensord.init %{buildroot}%{_initrddir}/sensord
install -D -m 0755 prog/init/fancontrol.service %{buildroot}%{_unitdir}/fancontrol.service
install -D -m 0755 prog/init/lm_sensors.service %{buildroot}%{_unitdir}/lm_sensors.service
install -D -m 0755 prog/init/sensord.service %{buildroot}%{_unitdir}/sensord.service
install -d %{buildroot}%{_sysconfdir}/sysconfig
> %{buildroot}%{_sysconfdir}/sysconfig/lm_sensors
sed -i "s|/usr/local|/usr|" \
%{buildroot}%{_initrddir}/fancontrol \
%{buildroot}%{_initrddir}/lm_sensors
#install -d %{buildroot}%{_sysconfdir}/sysconfig
#> %{buildroot}%{_sysconfdir}/sysconfig/lm_sensors
# remove installed kernel headers that will cause a conflict
rm -f %{buildroot}%{_includedir}/linux/*.h
@ -61,6 +60,24 @@ rm -f %{buildroot}%{_includedir}/linux/*.h
%post
/sbin/ldconfig
:
%preun
if [ $1 -eq 0 ]; then
systemctl -q stop lm_sensors
systemctl -q stop fancontrol
systemctl -q stop sensord
fi
:
%postun
/sbin/ldconfig
if [ $1 -eq 0 ]; then
systemctl -q daemon-reload
fi
:
%posttrans
%ifnarch arm
# FIXME: produces a system crash on ARM build platform, disable until better tests are done
if [ $1 -ge 1 ]; then
@ -81,34 +98,52 @@ if [ $1 -ge 1 ]; then
_EOF
systemctl -q daemon-reload
if [ -e %{_sysconfdir}/sysconfig/lm_sensors ]; then
systemctl -q enable lm_sensors
systemctl -q restart lm_sensors
fi
if [ -e %{_sysconfdir}/fancontrol ]; then
systemctl -q enable fancontrol
systemctl -q restart fancontrol
fi
if [ -e %{_sysconfdir}/sysconfig/sensorsd ]; then
systemctl -q enable sensord
systemctl -q restart sensord
fi
fi
%endif
exit 0
%postun -p /sbin/ldconfig
:
%files
%defattr(-,root,root)
%{_bindir}/*
%{_sbindir}/*
%config(noreplace) %{_sysconfdir}/sensors3.conf
%ghost %{_sysconfdir}/sysconfig/lm_sensors
%{_initrddir}/*
#%ghost %{_sysconfdir}/sysconfig/lm_sensors
%{_unitdir}/fancontrol.service
%{_unitdir}/lm_sensors.service
%{_unitdir}/sensord.service
%{_mandir}/man1/*
%{_mandir}/man5/*
%{_mandir}/man8/*
%{_libdir}/*.so.*
%doc CHANGES CONTRIBUTORS COPYING README
%{_libdir}/libsensors.so.*
%doc COPYING
%files devel
%defattr(-,root,root)
%{_libdir}/*.so
%{_libdir}/*.a
%{_libdir}/libsensors.so
%{_libdir}/libsensors.a
%dir %{_includedir}/sensors
%{_includedir}/sensors/*.h
%{_mandir}/man3/*
%doc CHANGES CONTRIBUTORS README
%changelog
* Tue Jun 10 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 3.3.5-2mamba
- sensors-detect: added patch to correctly detect kernel version
- switch to systemd support
* Sun Feb 02 2014 Automatic Build System <autodist@mambasoft.it> 3.3.5-1mamba
- automatic version update by autodist