- systemd units rework

This commit is contained in:
Jaromir Capik 2014-01-24 15:02:12 +01:00
parent 959ece00a3
commit d1273e9a46
8 changed files with 31 additions and 33 deletions

View File

@ -1,15 +0,0 @@
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

13
lm_sensors.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=Hardware Monitoring Sensors
[Service]
EnvironmentFile=/etc/sysconfig/lm_sensors
Type=oneshot
RemainAfterExit=yes
ExecStart=-@WRAPPER_DIR@/lm_sensors-modprobe-wrapper $BUS_MODULES $HWMON_MODULES
ExecStart=/usr/bin/sensors -s
ExecStop=-@WRAPPER_DIR@/lm_sensors-modprobe-r-wrapper $BUS_MODULES $HWMON_MODULES
[Install]
WantedBy=multi-user.target

View File

@ -1,6 +1,6 @@
Name: lm_sensors
Version: 3.3.5
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Hardware monitoring tools
Group: Applications/System
License: LGPLv2+ and GPLv3+ and GPLv2+ and Verbatim and Public domain
@ -11,13 +11,11 @@ Source: http://dl.lm-sensors.org/lm-sensors/releases/%{name}-%{version}.tar.bz2
Source1: lm_sensors.sysconfig
# these 2 were taken from PLD-linux, Thanks!
Source2: sensord.sysconfig
Source3: lm_sensors-modprobe
Source4: lm_sensors-modprobe-r
Source3: lm_sensors-modprobe-wrapper
Source4: lm_sensors-modprobe-r-wrapper
Source5: sensord.service
Source6: sensord-service-wrapper
Patch1: lm_sensors-3.3.4-lm_sensors-service-modprobe-warnings.patch
Source7: lm_sensors.service
Requires: /usr/sbin/modprobe
%ifarch %{ix86} x86_64
@ -64,15 +62,14 @@ database, and warns of sensor alarms.
%prep
%setup -q
%patch1 -p1
mv prog/init/README prog/init/README.initscripts
chmod -x prog/init/fancontrol.init
# fixing the sensord-service-wrapper path
cp -p %{SOURCE5} sensord.service
cp -p %{SOURCE7} lm_sensors.service
sed -i "s|\@WRAPPER_DIR\@|%{_libexecdir}/%{name}|" sensord.service
sed -i "s|\@WRAPPER_DIR\@|%{_libexecdir}/%{name}|" lm_sensors.service
%build
@ -96,14 +93,14 @@ install -pm 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/sensord
# service files
mkdir -p $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}
install -pm 644 lm_sensors.service $RPM_BUILD_ROOT%{_unitdir}
install -pm 644 sensord.service $RPM_BUILD_ROOT%{_unitdir}
# customized modprobe calls
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 %{SOURCE3} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/lm_sensors-modprobe-wrapper
install -pm 755 %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/lm_sensors-modprobe-r-wrapper
# sensord service wrapper
install -pm 755 %{SOURCE6} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/sensord-service-wrapper
@ -156,7 +153,7 @@ fi
%{_sbindir}/*
%{_unitdir}/lm_sensors.service
%{_unitdir}/fancontrol.service
%{_libexecdir}/%{name}/modprobe*
%{_libexecdir}/%{name}/lm_sensors-modprobe*wrapper
%config(noreplace) %{_sysconfdir}/sysconfig/lm_sensors
%exclude %{_sbindir}/sensord
%exclude %{_mandir}/man8/sensord.8.gz
@ -179,6 +176,9 @@ fi
%changelog
* Fri Jan 24 2014 Jaromir Capik <jcapik@redhat.com> - 3.3.5-2
- systemd units rework
* Thu Jan 23 2014 Jaromir Capik <jcapik@redhat.com> - 3.3.5-1
- Update to 3.3.5 (#1056448)

View File

@ -1,2 +1,2 @@
# /etc/sysconfig/sensors - Defines modules loaded by /etc/rc.d/init.d/lm_sensors
# Run sensors-detect to generate this config file
# /etc/sysconfig/lm_sensors - Defines modules loaded by the lm_sensors service
# Run 'sensors-detect' to generate this config file

View File

@ -1,5 +1,5 @@
[Unit]
Description=Log hardware monitoring data
Description=Hardware Monitoring Data Logger
After=lm_sensors.service
[Service]

View File

@ -1,6 +1,6 @@
# configuration for harware sensors monitoring daemon
# in intevrals use suffix "m" for minutes, "s" for seconds, "h" for hours
# 0 means turning facility off
# use suffix "m" for minutes, "s" for seconds, "h" for hours
# 0 turns the facility off
# interval between scanning alarms
INTERVAL=1m