Migrate quota_nld service from sysvinit to systemd
This commit is contained in:
parent
e48c3fad8e
commit
4d57643f9e
44
quota.spec
44
quota.spec
@ -14,8 +14,9 @@ Requires: quota-nls = %{epoch}:%{version}-%{release}
|
||||
Conflicts: kernel < 2.4
|
||||
BuildRequires: e2fsprogs-devel gettext tcp_wrappers-devel
|
||||
BuildRequires: openldap-devel dbus-devel libnl-devel
|
||||
BuildRequires: systemd-units
|
||||
Source0: http://downloads.sourceforge.net/linuxquota/%{name}-%{version}.tar.gz
|
||||
Source1: quota_nld.init
|
||||
Source1: quota_nld.service
|
||||
Source2: quota_nld.sysconfig
|
||||
# Not accepted changes (378a64006bb1e818e84a1c77808563b802b028fa)
|
||||
# Some of the lines have been superseded by other commits probably.
|
||||
@ -41,10 +42,10 @@ and limiting user and or group disk usage per file system.
|
||||
%package nld
|
||||
Summary: quota_nld daemon
|
||||
Group: System Environment/Base
|
||||
Requires: initscripts
|
||||
Requires: quota-nls = %{epoch}:%{version}-%{release}
|
||||
Requires(post): chkconfig
|
||||
Requires(preun): chkconfig initscripts
|
||||
Requires(post): systemd-sysv systemd-units
|
||||
Requires(preun): systemd-units
|
||||
Requires(postun): systemd-units
|
||||
|
||||
%description nld
|
||||
Daemon that listens on netlink socket and processes received quota warnings.
|
||||
@ -158,7 +159,7 @@ ln -s quotaon.8.gz \
|
||||
ln -s rquotad.8.gz \
|
||||
%{buildroot}%{_mandir}/man8/rpc.rquotad.8
|
||||
|
||||
install -p -m755 -D %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/quota_nld
|
||||
install -p -m644 -D %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/quota_nld.service
|
||||
install -p -m644 -D %{SOURCE2} \
|
||||
$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/quota_nld
|
||||
|
||||
@ -166,14 +167,34 @@ install -p -m644 -D %{SOURCE2} \
|
||||
|
||||
|
||||
%post nld
|
||||
/sbin/chkconfig --add quota_nld
|
||||
if [ $1 -eq 1 ] ; then
|
||||
# Initial installation
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%preun nld
|
||||
if [ $1 = 0 ] ; then
|
||||
/sbin/service quota_nld stop >/dev/null 2>&1
|
||||
/sbin/chkconfig --del quota_nld
|
||||
if [ $1 -eq 0 ] ; then
|
||||
# Package removal, not upgrade
|
||||
/bin/systemctl --no-reload disable quota_nld.service > /dev/null 2>&1 || :
|
||||
/bin/systemctl stop quota_nld.service > /dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%postun nld
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
if [ $1 -ge 1 ] ; then
|
||||
# Package upgrade, not uninstall
|
||||
/bin/systemctl try-restart quota_nld.service >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%triggerun -- %{name}-nld < 1:4.00-2
|
||||
echo 'quota-nld: User must migrate to systemd target manually by runnig:'
|
||||
echo ' systemd-sysv-convert --apply quota_nld'
|
||||
# Save the current service runlevel info
|
||||
/usr/bin/systemd-sysv-convert --save quota_nld >/dev/null 2>&1 || :
|
||||
# Run these because the SysV package being removed won't do them
|
||||
/sbin/chkconfig --del quota_nld >/dev/null 2>&1 || :
|
||||
/bin/systemctl try-restart quota_nld.service >/dev/null 2>&1 || :
|
||||
|
||||
|
||||
%files
|
||||
%attr(0755,root,root) /sbin/*
|
||||
@ -189,7 +210,7 @@ fi
|
||||
|
||||
%files nld
|
||||
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/sysconfig/quota_nld
|
||||
%attr(0755,root,root) %{_initrddir}/quota_nld
|
||||
%{_unitdir}/quota_nld.service
|
||||
%attr(0755,root,root) %{_sbindir}/quota_nld
|
||||
%attr(0644,root,root) %{_mandir}/man8/quota_nld.8*
|
||||
%doc Changelog
|
||||
@ -215,9 +236,10 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Aug 30 2011 Petr Pisar <ppisar@redhat.com> - 1:4.00-2
|
||||
* Wed Aug 31 2011 Petr Pisar <ppisar@redhat.com> - 1:4.00-2
|
||||
- Remove unneeded cryptographic library build-time dependencies
|
||||
- Fortify build-time configuration
|
||||
- Migrate quota_nld service from sysvinit to systemd
|
||||
|
||||
* Tue Aug 23 2011 Petr Pisar <ppisar@redhat.com> - 1:4.00-1
|
||||
- 4.00 bump
|
||||
|
||||
104
quota_nld.init
104
quota_nld.init
@ -1,104 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# quota_nld Disk quota netlink message daemon
|
||||
#
|
||||
# chkconfig: - 25 75
|
||||
# description: quota_nld is a deamon that listens on netlink socket and \
|
||||
# passes disk quota warnings produced by kernel to system \
|
||||
# D-Bus or terminal user has last accessed.
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: quota_nld
|
||||
# Required-Start: $local_fs
|
||||
# Should-Start: $syslog messagebus
|
||||
# Should-Stop: $syslog messagebus
|
||||
# Short-Description: Disk quota netlink message daemon
|
||||
# Description: quota_nld is a deamon that listens on netlink socket and \
|
||||
# passes disk quota warnings produced by kernel to system \
|
||||
# D-Bus or terminal user has last accessed.
|
||||
### END INIT INFO
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
exec="/usr/sbin/quota_nld"
|
||||
prog="quota_nld"
|
||||
|
||||
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
|
||||
|
||||
lockfile=/var/lock/subsys/$prog
|
||||
|
||||
start() {
|
||||
[ "$(id -u)" -eq 0 ] || exit 4
|
||||
[ -x $exec ] || exit 5
|
||||
echo -n $"Starting $prog: "
|
||||
daemon $exec $QUOTA_NLD_OPTS
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
stop() {
|
||||
[ "$(id -u)" -eq 0 ] || exit 4
|
||||
echo -n $"Stopping $prog: "
|
||||
killproc $prog
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && rm -f $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
force_reload() {
|
||||
restart
|
||||
}
|
||||
|
||||
rh_status() {
|
||||
status $prog
|
||||
}
|
||||
|
||||
rh_status_q() {
|
||||
rh_status >/dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
rh_status_q && exit 0
|
||||
$1
|
||||
;;
|
||||
stop)
|
||||
rh_status_q || exit 0
|
||||
$1
|
||||
;;
|
||||
restart)
|
||||
$1
|
||||
;;
|
||||
reload)
|
||||
rh_status_q || exit 7
|
||||
$1
|
||||
;;
|
||||
force-reload)
|
||||
force_reload
|
||||
;;
|
||||
status)
|
||||
rh_status
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
rh_status_q || exit 0
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
||||
exit 2
|
||||
esac
|
||||
exit $?
|
||||
12
quota_nld.service
Normal file
12
quota_nld.service
Normal file
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Disk quota netlink message daemon
|
||||
After=syslog.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
EnvironmentFile=-/etc/sysconfig/quota_nld
|
||||
ExecStart=/usr/sbin/quota_nld $QUOTA_NLD_OPTS
|
||||
PIDFile=/var/run/quota_nld.pid
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Loading…
Reference in New Issue
Block a user