789761 - Provide native systemd service
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
This commit is contained in:
parent
0049b681d6
commit
8c30c1d1c3
@ -1,12 +1,12 @@
|
||||
Name: lm_sensors
|
||||
Version: 3.3.1
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
URL: http://www.lm-sensors.org/
|
||||
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: sensord.init
|
||||
Source3: sensord.systemd
|
||||
Summary: Hardware monitoring tools
|
||||
Group: Applications/System
|
||||
License: LGPLv2+
|
||||
@ -76,7 +76,9 @@ 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
|
||||
install -p -m 755 %{SOURCE3} $RPM_BUILD_ROOT%{_initrddir}/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
|
||||
|
||||
@ -99,13 +101,24 @@ fi
|
||||
%postun libs -p /sbin/ldconfig
|
||||
|
||||
%post sensord
|
||||
/sbin/chkconfig --add sensord
|
||||
|
||||
%preun sensord
|
||||
if [ $1 = 0 ]; then
|
||||
/sbin/chkconfig --del sensord
|
||||
if [ $1 -eq 1 ] ; then
|
||||
# Initial installation
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%preun sensord
|
||||
if [ $1 -eq 0 ] ; then
|
||||
# Package removal, not upgrade
|
||||
/bin/systemctl --no-reload disable sensord.service > /dev/null 2>&1 || :
|
||||
/bin/systemctl stop sensord.service > /dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%postun
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
if [ $1 -ge 1 ] ; then
|
||||
# Package upgrade, not uninstall
|
||||
/bin/systemctl try-restart sensord.service >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
@ -121,7 +134,6 @@ fi
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/lm_sensors
|
||||
%exclude %{_sbindir}/sensord
|
||||
%exclude %{_mandir}/man8/sensord.8.gz
|
||||
%dir %{_sysconfdir}/sensors.d
|
||||
|
||||
%files libs
|
||||
%defattr(-,root,root,-)
|
||||
@ -138,11 +150,14 @@ fi
|
||||
%doc prog/sensord/README
|
||||
%{_sbindir}/sensord
|
||||
%{_mandir}/man8/sensord.8.gz
|
||||
%{_initrddir}/sensord
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/sensord
|
||||
/lib/systemd/system/sensord.service
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Feb 13 2012 Nikola Pajkovsky <npajkovs@redhat.com> - 3.3.1-3
|
||||
- 789761 - Provide native systemd service
|
||||
|
||||
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
|
||||
|
||||
|
76
sensord.init
76
sensord.init
@ -1,76 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# sensord: Hardware sensors monitoring daemon
|
||||
#
|
||||
# chkconfig: - 27 73
|
||||
# description: Starts and stops hardware sensors monitoring daemon.
|
||||
# config: /etc/sysconfig/sensord
|
||||
# author: Filip Kalinski <filon@pld.org.pl>
|
||||
# adapted for fedora by Hans de Goede <j.w.r.degoede@hhs.nl>
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
# Get service config
|
||||
if [ -f /etc/sysconfig/sensord ]; then
|
||||
. /etc/sysconfig/sensord
|
||||
fi
|
||||
|
||||
prog="sensord"
|
||||
|
||||
start() {
|
||||
echo -n $"Starting $prog: "
|
||||
|
||||
if [ ! -f /var/lock/subsys/lm_sensors ]; then
|
||||
echo -n "error lm_sensors service not started"
|
||||
echo_failure
|
||||
echo
|
||||
exit 6
|
||||
fi
|
||||
|
||||
daemon sensord \
|
||||
${INTERVAL:+-i $INTERVAL} \
|
||||
${LOG_INTERVAL:+-l $LOG_INTERVAL} \
|
||||
${RRD_LOGFILE:+-r $RRD_LOGFILE} \
|
||||
${RRD_INTERVAL:+-t $RRD_INTERVAL} \
|
||||
-f daemon
|
||||
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/sensord
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
|
||||
killproc sensord
|
||||
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sensord
|
||||
}
|
||||
|
||||
RETVAL=0
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status sensord
|
||||
RETVAL=$?
|
||||
sensors
|
||||
;;
|
||||
restart|force-reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
msg_usage "$0 {start|stop|restart|force-reload|status}"
|
||||
exit 3
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
11
sensord.systemd
Normal file
11
sensord.systemd
Normal file
@ -0,0 +1,11 @@
|
||||
[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
|
Loading…
Reference in New Issue
Block a user