rework the spec and init script to respect the systemd (bz 659622)
This commit is contained in:
parent
7abd4df7f5
commit
fa0ec0283d
@ -1,94 +0,0 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: irqbalance
|
||||
# Default-Start: 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: start and stop irqbalance daemon
|
||||
# Description: The irqbalance daemon will distribute interrupts across
|
||||
# the cpus on a multiprocessor system with the purpose of
|
||||
# spreading the load
|
||||
### END INIT INFO
|
||||
# chkconfig: 2345 13 87
|
||||
|
||||
|
||||
# This is an interactive program, we need the current locale
|
||||
|
||||
# Source function library.
|
||||
. /etc/init.d/functions
|
||||
|
||||
# Check that we're a priviledged user
|
||||
[ `id -u` = 0 ] || exit 0
|
||||
|
||||
|
||||
prog="irqbalance"
|
||||
|
||||
[ -f /usr/sbin/irqbalance ] || exit 0
|
||||
|
||||
# fetch configuration if it exists
|
||||
# ONESHOT=yes says to wait for a minute, then look at the interrupt
|
||||
# load and balance it once; after balancing exit and do not change
|
||||
# it again.
|
||||
# The default is to keep rebalancing once every 10 seconds.
|
||||
ONESHOT=
|
||||
[ -f /etc/sysconfig/irqbalance ] && . /etc/sysconfig/irqbalance
|
||||
case "$ONESHOT" in
|
||||
y*|Y*|on) ONESHOT=--oneshot ;;
|
||||
*) ONESHOT= ;;
|
||||
esac
|
||||
|
||||
RETVAL=0
|
||||
|
||||
start() {
|
||||
if [ -n "$ONESHOT" -a -f /var/run/irqbalance.pid ]; then
|
||||
exit 0
|
||||
fi
|
||||
echo -n $"Starting $prog: "
|
||||
if [ -n "$IRQ_AFFINITY_MASK" ];
|
||||
then
|
||||
export IRQBALANCE_BANNED_CPUS=$IRQ_AFFINITY_MASK
|
||||
fi
|
||||
daemon irqbalance $ONESHOT
|
||||
RETVAL=$?
|
||||
echo
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
killproc irqbalance
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/irqbalance
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status irqbalance
|
||||
;;
|
||||
restart|reload|force-reload)
|
||||
restart
|
||||
;;
|
||||
condrestart)
|
||||
[ -f /var/lock/subsys/irqbalance ] && restart || :
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart|force-reload}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $?
|
11
irqbalance.service
Normal file
11
irqbalance.service
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=irqbalance daemon
|
||||
After=syslog.target
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=/etc/sysconfig/irqbalance
|
||||
Type=forking
|
||||
ExecStart=/usr/sbin/irqbalance $ONESHOT
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,24 +1,24 @@
|
||||
Summary: IRQ balancing daemon
|
||||
Name: irqbalance
|
||||
Version: 0.56
|
||||
Release: 2%{?dist}
|
||||
Epoch: 2
|
||||
Release: 3%{?dist}
|
||||
Epoch: 2
|
||||
Group: System Environment/Base
|
||||
License: GPLv2
|
||||
Url: http://irqbalance.org/
|
||||
Source0: http://irqbalance.googlecode.com/files/irqbalance-%{version}.tbz2
|
||||
Source1: irqbalance.init
|
||||
Source2: irqbalance.sysconfig
|
||||
Source3: irqbalance.1
|
||||
Url: http://irqbalance.org/
|
||||
Source0: http://irqbalance.googlecode.com/files/irqbalance-%{version}.tbz2
|
||||
Source1: irqbalance.service
|
||||
Source2: irqbalance.sysconfig
|
||||
Source3: irqbalance.1
|
||||
Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
||||
BuildRequires: autoconf automake libtool libcap-ng
|
||||
Requires(post): chkconfig
|
||||
Requires(postun):chkconfig
|
||||
Requires(preun):chkconfig
|
||||
BuildRequires: autoconf automake libtool libcap-ng
|
||||
Requires(post): systemd-units
|
||||
Requires(postun):systemd-units
|
||||
Requires(preun):systemd-units
|
||||
#Requires(triggerun):systemd-units
|
||||
|
||||
ExclusiveArch: %{ix86} x86_64 ia64 ppc ppc64
|
||||
Obsoletes: kernel-utils
|
||||
BuildRequires: glib2-devel pkgconfig imake libcap-ng-devel
|
||||
ExclusiveArch: %{ix86} x86_64 ia64 ppc ppc64
|
||||
BuildRequires: glib2-devel pkgconfig imake libcap-ng-devel
|
||||
|
||||
|
||||
%description
|
||||
@ -44,7 +44,7 @@ CFLAGS="%{optflags}" make %{?_smp_mflags}
|
||||
rm -rf %{buildroot}
|
||||
cd %{name}-%{version}
|
||||
install -D -p -m 0755 %{name} %{buildroot}%{_sbindir}/%{name}
|
||||
install -D -p -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name}
|
||||
install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/irqbalance.service
|
||||
install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
|
||||
|
||||
install -d %{buildroot}%{_mandir}/man1/
|
||||
@ -56,24 +56,40 @@ rm -rf %{buildroot}
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%{_sbindir}/irqbalance
|
||||
%{_initrddir}/irqbalance
|
||||
%{_unitdir}/irqbalance.service
|
||||
%{_mandir}/man1/*
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/irqbalance
|
||||
|
||||
%preun
|
||||
if [ "$1" = "0" ] ; then
|
||||
/sbin/chkconfig --del irqbalance
|
||||
%post
|
||||
if [ $1 -eq 1 ]; then
|
||||
# Initial installation
|
||||
/bin/systemctl enable irqbalance.service >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%post
|
||||
/sbin/chkconfig --add irqbalance
|
||||
%preun
|
||||
if [ $1 -eq 0 ] ; then
|
||||
# Package removal, not upgrade
|
||||
/bin/systemctl disable irqbalance.service >/dev/null 2>&1 || :
|
||||
/bin/systemctl stop irqbalance.service > /dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%triggerpostun -- kernel-utils
|
||||
/sbin/chkconfig --add irqbalance
|
||||
exit 0
|
||||
%postun
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
if [ $1 -ge 1 ] ; then
|
||||
# Package upgrade, not uninstall
|
||||
/bin/systemctl try-restart irqbalance.service >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%triggerun -- irqbalance < 0.56-3
|
||||
if /sbin/chkconfig irqbalance ; then
|
||||
/sbin/chkconfig --del irqbalance >/dev/null 2>&1 || :
|
||||
/bin/systemctl enable irqbalance.service >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%changelog
|
||||
* Fri Mar 25 2011 Anton Arapov <anton@redhat.com> - 2:0.56-3
|
||||
- rework init in order to respect systemd. (bz 659622)
|
||||
|
||||
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2:0.56-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user