From 3d7165a751ae568691763918d7149ee61c5003af Mon Sep 17 00:00:00 2001 From: Jaromir Capik Date: Tue, 30 Jul 2013 18:27:27 +0200 Subject: [PATCH] - Avoiding modprobe errors when no sensors configured (#834215) - Introducing fancontrol service file (#988922) - Replacing hardcoded systemd unit path with _unitdir macro --- ...lm_sensors-service-modprobe-warnings.patch | 15 +++++++ lm_sensors-modprobe | 8 ++++ lm_sensors-modprobe-r | 8 ++++ lm_sensors.spec | 40 +++++++++++++------ sensord.systemd | 11 ----- 5 files changed, 59 insertions(+), 23 deletions(-) create mode 100644 lm_sensors-3.3.4-lm_sensors-service-modprobe-warnings.patch create mode 100755 lm_sensors-modprobe create mode 100755 lm_sensors-modprobe-r delete mode 100644 sensord.systemd diff --git a/lm_sensors-3.3.4-lm_sensors-service-modprobe-warnings.patch b/lm_sensors-3.3.4-lm_sensors-service-modprobe-warnings.patch new file mode 100644 index 0000000..c3c545e --- /dev/null +++ b/lm_sensors-3.3.4-lm_sensors-service-modprobe-warnings.patch @@ -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 diff --git a/lm_sensors-modprobe b/lm_sensors-modprobe new file mode 100755 index 0000000..4d7e753 --- /dev/null +++ b/lm_sensors-modprobe @@ -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 diff --git a/lm_sensors-modprobe-r b/lm_sensors-modprobe-r new file mode 100755 index 0000000..46027cf --- /dev/null +++ b/lm_sensors-modprobe-r @@ -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 diff --git a/lm_sensors.spec b/lm_sensors.spec index f91da5b..9ac37b4 100644 --- a/lm_sensors.spec +++ b/lm_sensors.spec @@ -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 - 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 - 3.3.4-3 - Avoiding warnings when piping /dev/null to sensors-detect (#843507) diff --git a/sensord.systemd b/sensord.systemd deleted file mode 100644 index 4df7ad4..0000000 --- a/sensord.systemd +++ /dev/null @@ -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