[quota] Add quota_nld init script

Petr Pisar ppisar at fedoraproject.org
Thu Nov 11 17:05:02 UTC 2010


commit 8139e22ee6b8438dbd17a78168c6f130b88afe1c
Author: Petr Písař <ppisar at redhat.com>
Date:   Thu Nov 11 15:14:19 2010 +0100

    Add quota_nld init script

 quota.spec          |   25 ++++++++++++-
 quota_nld.init      |  102 +++++++++++++++++++++++++++++++++++++++++++++++++++
 quota_nld.sysconfig |    4 ++
 3 files changed, 130 insertions(+), 1 deletions(-)
---
diff --git a/quota.spec b/quota.spec
index a85a771..145f257 100644
--- a/quota.spec
+++ b/quota.spec
@@ -5,16 +5,20 @@ Name: quota
 Summary: System administration tools for monitoring users' disk usage
 Epoch: 1
 Version: 3.17
-Release: 14%{?dist}
+Release: 15%{?dist}
 License: BSD and GPLv2+
 URL: http://sourceforge.net/projects/linuxquota/
 Group: System Environment/Base
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: initscripts >= 6.38 tcp_wrappers
+Requires(post): chkconfig
+Requires(preun): chkconfig initscripts
 Conflicts: kernel < 2.4
 BuildRequires: e2fsprogs-devel gettext tcp_wrappers-devel nss-devel
 BuildRequires: openldap-devel openssl-devel dbus-devel libnl-devel
 Source0: http://downloads.sourceforge.net/linuxquota/%{name}-%{version}.tar.gz
+Source1: quota_nld.init
+Source2: quota_nld.sysconfig
 Patch0: quota-3.06-warnquota.patch
 Patch1: quota-3.06-no-stripping.patch
 Patch2: quota-3.06-man-page.patch
@@ -100,8 +104,23 @@ 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 %{SOURCE2} \
+    $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/quota_nld
+
 %find_lang %{name}
 
+
+%post
+/sbin/chkconfig --add quota_nld
+
+%preun
+if [ $1 = 0 ] ; then
+    /sbin/service quota_nld stop >/dev/null 2>&1
+    /sbin/chkconfig --del quota_nld
+fi
+
+
 %clean
 rm -rf %{buildroot}
 
@@ -109,6 +128,7 @@ rm -rf %{buildroot}
 %files -f %{name}.lang
 %defattr(-,root,root,-)
 %config(noreplace) %attr(0644,root,root) %{_sysconfdir}/*
+%attr(0755,root,root) %{_initrddir}/quota_nld
 %attr(0755,root,root) /sbin/*
 %attr(0755,root,root) %{_bindir}/*
 %attr(0755,root,root) %{_sbindir}/*
@@ -122,6 +142,9 @@ rm -rf %{buildroot}
 %attr(0644,root,root) %{_mandir}/man3/*
 
 %changelog
+* Thu Nov 11 2010 Petr Pisar <ppisar at redhat.com> - 1:3.17-15
+- Add quota_nld deamon init script (bug #634169)
+
 * Wed Oct 06 2010 Petr Pisar <ppisar at redhat.com> - 1:3.17-14
 - Remove quotactl(2) as it's part of `man-pages' package (bug #640590)
 
diff --git a/quota_nld.init b/quota_nld.init
new file mode 100755
index 0000000..4a1a94d
--- /dev/null
+++ b/quota_nld.init
@@ -0,0 +1,102 @@
+#!/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() {
+    [ -x $exec ] || exit 5
+    echo -n $"Starting $prog: "
+    $exec $QUOTA_NLD_OPTS
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    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 $?
diff --git a/quota_nld.sysconfig b/quota_nld.sysconfig
new file mode 100644
index 0000000..8e4f121
--- /dev/null
+++ b/quota_nld.sysconfig
@@ -0,0 +1,4 @@
+# Arguments to pass to quota_nld daemon.
+# -D, --no-dbus     Do not forward messages to D-Bus
+# -C, --no-console  Do not print messages on last user's terminal
+QUOTA_NLD_OPTS=""


More information about the scm-commits mailing list