Author: guillomovitch
Date: Fri Dec 8 12:18:03 2006
New Revision: 92239
Modified:
packages/cooker/proftpd/current/SOURCES/proftpd.init
packages/cooker/proftpd/current/SPECS/proftpd.spec
Log:
drop excessive dependencies on additional modules, none is really mandatory
(fix #27362)
rewrite init scripts:
- use functions to avoid useless forks
- use less useless conditionals
- use lockfile to determine running status
- condrestart entry
use init script condrestart entry from modules %%post and %%postun
Modified: packages/cooker/proftpd/current/SOURCES/proftpd.init
==============================================================================
--- packages/cooker/proftpd/current/SOURCES/proftpd.init (original)
+++ packages/cooker/proftpd/current/SOURCES/proftpd.init Fri Dec 8
12:18:03 2006
@@ -27,108 +27,109 @@
# including support for multiple 'virtual' FTP servers,
# anonymous FTP, and permission-based directory visibility.
### END INIT INFO
-#
-# By: Osman Elliyasa <[EMAIL PROTECTED]>
-# $Id: proftpd.init.d,v 1.2 2001/01/26 23:10:55 flood Exp $
-# modified by [EMAIL PROTECTED]
# Source function library.
. /etc/rc.d/init.d/functions
-# Get config.
+# source network configuration
. /etc/sysconfig/network
# Check that networking is up.
-if [ ${NETWORKING} = "no" ]
-then
- exit 0
-fi
-
-[ -x /usr/sbin/proftpd ] || exit 0
+[ ${NETWORKING} = "no" ] && exit 0
+NAME=proftpd
FTPSHUT=/usr/sbin/ftpshut
+LOCKFILE=/var/lock/subsys/$NAME
RETVAL=0
-# See how we were called.
-case "$1" in
- start)
- if [ -n "`/sbin/pidof proftpd`" ]; then
- echo -n "proftpd: already running"
- failure
- echo
- exit 1
- fi
- echo -n "Starting proftpd: "
- daemon proftpd >/dev/null 2>&1 && success
+start() {
+ # Check if it is already running
+ if [ ! -f $LOCKFILE ]; then
+ echo -n "Starting $NAME"
+ daemon "proftpd >/dev/null 2>&1"
RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch $LOCKFILE
echo
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/proftpd
+ fi
+}
+
+stop() {
+ echo -n "Stopping $NAME"
+ killproc proftpd
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
+ echo
+}
+
+reload() {
+ echo -n "Reloading $NAME"
+ killproc proftpd -HUP
+ RETVAL=$?
+ echo
+}
+
+suspend() {
+ if [ $# -gt 1 ]; then
+ shift
+ echo -n "Suspending proftpd with '$*' "
+ $FTPSHUT $*
+ else
+ echo -n "Suspending proftpd NOW "
+ $FTPSHUT now "Maintenance in progress"
+ fi
+ killproc proftpd
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
+}
+
+resume() {
+ if [ -f /etc/shutmsg ]; then
+ echo -n "Allowing proftpd sessions again "
+ rm -f /etc/shutmsg
+ else
+ echo -n "Starting proftpd; was not suspended "
+ fi
+ daemon "proftpd >/dev/null 2>&1"
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch $LOCKFILE
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
;;
- stop)
- echo -n "Shutting down proftpd: "
- killproc proftpd
- RETVAL=$?
- echo
- [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/proftpd
+ stop)
+ stop
;;
- status)
+ status)
status proftpd
RETVAL=$?
;;
- restart)
- $0 stop
- $0 start
- RETVAL=$?
+ restart)
+ stop
+ start
;;
- reload)
- echo -n "Re-reading proftpd config: "
- killproc proftpd -HUP
- RETVAL=$?
- echo
- ;;
- suspend)
- if [ -f $FTPSHUT ]; then
- if [ $# -gt 1 ]; then
- shift
- echo -n "Suspending proftpd with '$*' "
- $FTPSHUT $*
- else
- echo -n "Suspending proftpd NOW "
- $FTPSHUT now "Maintenance in progress"
- fi
- else
- echo -n "No way to suspend, shutting down instead "
+ condrestart)
+ if [ -f $LOCKFILE ]; then
+ start
+ stop
fi
- killproc proftpd
- RETVAL=$?
- echo
- [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/proftpd
- ;;
- resume)
- if [ -f /etc/shutmsg ]; then
- echo -n "Allowing proftpd sessions again "
- rm -f /etc/shutmsg
- else
- echo -n "Starting proftpd; was not suspended "
- fi
- daemon proftpd
- echo
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/proftpd
+ ;;
+ reload)
+ reload
+ ;;
+ suspend)
+ suspend
;;
- *)
- echo -n "Usage: $0 {start|stop|status|restart|reload|resume"
- if [ "$FTPSHUT" = "" ]; then
- echo "}"
- else
- echo "|suspend}"
- echo "suspend accepts additional arguments which are passed to
ftpshut(8)"
- fi
+ resume)
+ resume
+ ;;
+ *)
+ echo -n "Usage: $0
{start|stop|status|restart|condrestart|reload|resume|suspend} [time]"
exit 1
esac
-if [ $# -gt 1 ]; then
- shift
- $0 $*
-fi
-
exit $RETVAL
Modified: packages/cooker/proftpd/current/SPECS/proftpd.spec
==============================================================================
--- packages/cooker/proftpd/current/SPECS/proftpd.spec (original)
+++ packages/cooker/proftpd/current/SPECS/proftpd.spec Fri Dec 8 12:18:03 2006
@@ -81,14 +81,6 @@
BuildRequires: tcp_wrappers-devel
BuildRequires: zlib-devel
Provides: ftpserver
-# this is to make the transition easier for some people...
-Requires: %{name}-mod_wrap = %{version}-%{release}
-Requires: %{name}-mod_gss = %{version}-%{release}
-Requires: %{name}-mod_ldap = %{version}-%{release}
-Requires: %{name}-mod_radius = %{version}-%{release}
-Requires: %{name}-mod_ratio = %{version}-%{release}
-Requires: %{name}-mod_rewrite = %{version}-%{release}
-Requires: %{name}-mod_tls = %{version}-%{release}
Conflicts: wu-ftpd ncftpd beroftpd anonftp
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
@@ -566,12 +558,14 @@
EOF
cat > README.urpmi << EOF
-proftpd-1.3.0 now loads the modules dynamically, very few modules are compiled
into the proftpd
-binary. The new configuration file /etc/proftpd.conf uses a "Include
/etc/proftpd.d/*.conf" statement
-which makes proftpd very similar to how modules are loaded and the
configuration of apache-2.x. Because
-of this you may have to manually merge your old configuration into the new
/etc/proftpd.conf file.
-This is especially true if you are using LDAP, because then the mod_ldap.so
proftpd module will not be
-automatically loaded. Here is a list of the modules that are compiled as DSO's:
+proftpd-1.3.0 now loads the modules dynamically, very few modules are compiled
+into the proftpd binary. The new configuration file /etc/proftpd.conf uses a
+"Include /etc/proftpd.d/*.conf" statement which makes proftpd very similar to
+how modules are loaded and the configuration of apache-2.x. Because of this you
+may have to manually merge your old configuration into the new
+/etc/proftpd.conf file. This is especially true if you are using LDAP, because
+then the mod_ldap.so proftpd module will not be automatically loaded. Here is a
+list of the modules that are compiled as DSO's:
o mod_autohost.so <- NEW
o mod_case.so <- NEW
@@ -665,279 +659,187 @@
fi
%post -n %{name}-mod_autohost
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_autohost
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_case
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_case
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_clamav
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_clamav
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_ctrls_admin
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_ctrls_admin
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_facl
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_facl
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_gss
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_gss
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_ifsession
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_ifsession
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_ldap
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_ldap
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_load
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_load
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_quotatab_file
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_quotatab_file
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_quotatab
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_quotatab
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_radius
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_radius
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_ratio
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_ratio
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_rewrite
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_rewrite
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_shaper
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_shaper
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_site_misc
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_site_misc
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_sql_mysql
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_sql_mysql
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_sql
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_sql
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_time
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_time
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_tls
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_tls
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_wrap_file
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_wrap_file
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_wrap
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_wrap
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%post -n %{name}-mod_wrap_sql
-if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2;
-fi
+service proftpd condrestart
%postun -n %{name}-mod_wrap_sql
if [ "$1" = 0 ]; then
- if [ -f /var/lock/subsys/proftpd ]; then
- %{_initrddir}/proftpd restart 1>&2
- fi
+ service proftpd condrestart
fi
%clean
@@ -947,6 +849,7 @@
%defattr(-,root,root)
%doc README* ChangeLog INSTALL NEWS CREDITS COPYING doc/* README.urpmi
%doc sample-configurations/*
+%{_sysconfdir}/proftpd.d
%attr(600,root,root) %config(noreplace) %{_sysconfdir}/%{name}.conf
#%config(noreplace) %{_sysconfdir}/ftpusers
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/pam.d/%{name}