- Avoiding modprobe errors when no sensors configured (#834215)

- Introducing fancontrol service file (#988922)
- Replacing hardcoded systemd unit path with _unitdir macro
This commit is contained in:
Jaromir Capik 2013-07-30 18:27:27 +02:00
parent 94142e5e5d
commit 3d7165a751
5 changed files with 59 additions and 23 deletions

View File

@ -0,0 +1,15 @@
diff -Naur lm_sensors-3.3.4.orig/prog/init/lm_sensors.service lm_sensors-3.3.4/prog/init/lm_sensors.service
--- lm_sensors-3.3.4.orig/prog/init/lm_sensors.service 2011-04-27 19:35:18.000000000 +0200
+++ lm_sensors-3.3.4/prog/init/lm_sensors.service 2013-07-30 17:03:23.918671002 +0200
@@ -6,9 +6,9 @@
EnvironmentFile=/etc/sysconfig/lm_sensors
Type=oneshot
RemainAfterExit=yes
-ExecStart=-/sbin/modprobe -qab $BUS_MODULES $HWMON_MODULES
+ExecStart=-/usr/libexec/lm_sensors/modprobe $BUS_MODULES $HWMON_MODULES
ExecStart=/usr/bin/sensors -s
-ExecStop=-/sbin/modprobe -qabr $BUS_MODULES $HWMON_MODULES
+ExecStop=-/usr/libexec/lm_sensors/modprobe-r $BUS_MODULES $HWMON_MODULES
[Install]
WantedBy=multi-user.target

8
lm_sensors-modprobe Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
if [ $# -ne 0 ]; then
/sbin/modprobe -ab $@
else
echo "No sensors with loadable kernel modules configured."
echo "Please, run 'sensors-detect' as root in order to search for available sensors."
exit 1
fi

8
lm_sensors-modprobe-r Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
if [ $# -ne 0 ]; then
/sbin/modprobe -abr $@
else
echo "No sensors with loadable kernel modules configured."
echo "Please, run 'sensors-detect' as root in order to search for available sensors."
exit 1
fi

View File

@ -1,6 +1,6 @@
Name: lm_sensors
Version: 3.3.4
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Hardware monitoring tools
Group: Applications/System
License: LGPLv2+
@ -12,8 +12,11 @@ Source1: lm_sensors.sysconfig
# these 2 were taken from PLD-linux, Thanks!
Source2: sensord.sysconfig
Source3: sensord.systemd
Source4: lm_sensors-modprobe
Source5: lm_sensors-modprobe-r
Patch0: lm_sensors-3.3.4-sensors-detect-null-input.patch
Patch1: lm_sensors-3.3.4-lm_sensors-service-modprobe-warnings.patch
%ifarch %{ix86} x86_64
Requires: /usr/sbin/dmidecode
@ -59,6 +62,7 @@ database, and warns of sensor alarms.
%setup -q
%patch0 -p1
%patch1 -p1
mv prog/init/README prog/init/README.initscripts
chmod -x prog/init/fancontrol.init
@ -77,17 +81,22 @@ rm $RPM_BUILD_ROOT%{_libdir}/libsensors.a
ln -s sensors.conf.5.gz $RPM_BUILD_ROOT%{_mandir}/man5/sensors3.conf.5.gz
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sensors.d
mkdir -p $RPM_BUILD_ROOT%{_initrddir}
mkdir -p $RPM_BUILD_ROOT/lib/systemd/system
install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/lm_sensors
install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/sensord
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sensors.d
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
install -pm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/lm_sensors
install -pm 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/sensord
# remove it after upstream includes sensord.service in repo
install -p -m 755 %{SOURCE3} $RPM_BUILD_ROOT/lib/systemd/system/sensord.service
install -p -m 644 prog/init/lm_sensors.service \
$RPM_BUILD_ROOT/lib/systemd/system
# service files
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
install -pm 644 prog/init/sensord.service $RPM_BUILD_ROOT%{_unitdir}
install -pm 644 prog/init/lm_sensors.service $RPM_BUILD_ROOT%{_unitdir}
install -pm 644 prog/init/fancontrol.service $RPM_BUILD_ROOT%{_unitdir}
# customized modprobe calls
mkdir -p $RPM_BUILD_ROOT%{_libexecdir}/%{name}
install -pm 755 %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/modprobe
install -pm 755 %{SOURCE5} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/modprobe-r
# Note non standard systemd scriptlets, since reload / stop makes no sense
@ -135,7 +144,9 @@ fi
%{_mandir}/man5/*
%{_mandir}/man8/*
%{_sbindir}/*
/lib/systemd/system/lm_sensors.service
%{_unitdir}/lm_sensors.service
%{_unitdir}/fancontrol.service
%{_libexecdir}/%{name}/modprobe*
%config(noreplace) %{_sysconfdir}/sysconfig/lm_sensors
%exclude %{_sbindir}/sensord
%exclude %{_mandir}/man8/sensord.8.gz
@ -153,10 +164,15 @@ fi
%{_sbindir}/sensord
%{_mandir}/man8/sensord.8.gz
%config(noreplace) %{_sysconfdir}/sysconfig/sensord
/lib/systemd/system/sensord.service
%{_unitdir}/sensord.service
%changelog
* Tue Jul 30 2013 Jaromir Capik <jcapik@redhat.com> - 3.3.4-4
- Avoiding modprobe errors when no sensors configured (#834215)
- Introducing fancontrol service file (#988922)
- Replacing hardcoded systemd unit path with _unitdir macro
* Thu Jul 25 2013 Jaromir Capik <jcapik@redhat.com> - 3.3.4-3
- Avoiding warnings when piping /dev/null to sensors-detect (#843507)

View File

@ -1,11 +0,0 @@
[Unit]
Description=Sensor Information Logging
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/sensord
PIDFile=/run/sensord.pid
ExecStart=/usr/sbin/sensord -i $INTERVAL -l $LOG_INTERVAL -f daemon
[Install]
WantedBy=multi-user.target