Bug#613527: proftpd: config file as a variable in init.d script

Sandro Tosi morph at debian.org
Tue Feb 15 13:31:46 UTC 2011


Package: proftpd-basic
Severity: minor

Hi,
we have a peculiar setup and so we have one config file for each machine, and
being able to specify it in the init.d script is a must. I noticed it's
currently hardcoded the full path to the file in the script, so a fast work of
cut&paste generate this patch taht replace the full path with a CONFFILE
variabile, and also add it to the call that starts the deamon.

HTH,
Sandro

-- System Information:
Debian Release: 6.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.37-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
-------------- next part --------------
--- proftpd.orig	2011-02-15 13:48:16.000000000 +0100
+++ proftpd	2011-02-15 13:58:05.000000000 +0100
@@ -18,12 +18,13 @@
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 DAEMON=/usr/sbin/proftpd
 NAME=proftpd
+CONFFILE=/etc/proftpd/proftpd.conf
 
 # Defaults
 RUN="no"
 OPTIONS=""
 
-PIDFILE=`grep -i 'pidfile' /etc/proftpd/proftpd.conf | sed -e 's/pidfile[\t ]\+//i'`
+PIDFILE=`grep -i 'pidfile' $CONFFILE | sed -e 's/pidfile[\t ]\+//i'`
 if [ "x$PIDFILE" = "x" ];
 then
 	PIDFILE=/var/run/proftpd.pid
@@ -43,7 +44,7 @@
 # Servertype could be inetd|standalone|none.
 # In all cases check against inetd and xinetd support.
 #
-if ! egrep -qi "^[[:space:]]*ServerType.*standalone" /etc/proftpd/proftpd.conf
+if ! egrep -qi "^[[:space:]]*ServerType.*standalone" $CONFFILE
 then
 	if egrep -qi "server[[:space:]]*=[[:space:]]*/usr/sbin/proftpd" /etc/xinetd.conf 2>/dev/null || \
 	   egrep -qi "server[[:space:]]*=[[:space:]]*/usr/sbin/proftpd" /etc/xinetd.d/* 2>/dev/null || \
@@ -52,7 +53,7 @@
     		RUN="no"
     		INETD="yes"
 	else
-		if ! egrep -qi "^[[:space:]]*ServerType.*inetd" /etc/proftpd/proftpd.conf
+		if ! egrep -qi "^[[:space:]]*ServerType.*inetd" $CONFFILE
 		then
     		RUN="yes"
 			INETD="no"
@@ -78,7 +79,7 @@
 {
     log_daemon_msg "Starting ftp server" "$NAME"
 
-    start-stop-daemon --start --quiet --pidfile "$PIDFILE" --oknodo --exec $DAEMON -- $OPTIONS  
+    start-stop-daemon --start --quiet --pidfile "$PIDFILE" --oknodo --exec $DAEMON -- $OPTIONS --config $CONFFILE
     if [ $? != 0 ]; then
         log_end_msg 1
         exit 1


More information about the Pkg-proftpd-maintainers mailing list