packages: courier-imap/courier-imap-ssl.init - unify with template

glen glen at pld-linux.org
Sun Apr 11 22:25:18 CEST 2010


Author: glen                         Date: Sun Apr 11 20:25:18 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- unify with template

---- Files affected:
packages/courier-imap:
   courier-imap-ssl.init (1.5 -> 1.6) 

---- Diffs:

================================================================
Index: packages/courier-imap/courier-imap-ssl.init
diff -u packages/courier-imap/courier-imap-ssl.init:1.5 packages/courier-imap/courier-imap-ssl.init:1.6
--- packages/courier-imap/courier-imap-ssl.init:1.5	Sun Apr 11 00:56:47 2010
+++ packages/courier-imap/courier-imap-ssl.init	Sun Apr 11 22:25:12 2010
@@ -27,40 +27,63 @@
 	exit 0
 fi
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-start)
+start() {
 	# Check if the service is already running?
+	if [ -f /var/lock/subsys/courier-imap-ssl ]; then
+		msg_already_running "Courier IMAP SSL"
+		return
+	fi
+
+	if [ -x "$COURIERTLS" -a ! -f "$TLS_CERTFILE" ]; then
+		msg_starting "Courier IMAP SSL cert generation"
+		daemon $sbindir/mkimapdcert
+	fi
+	msg_starting "Courier IMAP SSL"
+	daemon $libexecdir/imapd-ssl.rc start
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/courier-imap-ssl
+}
+
+stop() {
 	if [ ! -f /var/lock/subsys/courier-imap-ssl ]; then
-		if [ -x "$COURIERTLS" -a ! -f "$TLS_CERTFILE" ]; then
-			msg_starting "Courier IMAP SSL cert generation"
-			daemon $sbindir/mkimapdcert
-		fi
-		msg_starting "Courier IMAP SSL"
-		daemon $libexecdir/imapd-ssl.rc start
-		RETVAL=$?
-		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/courier-imap-ssl
-	else
-		msg_already_running imapd-ssl
+		msg_not_running "Courier IMAP SSL"
+		return
 	fi
-	;;
-stop)
-	if [ -f /var/lock/subsys/courier-imap-ssl ]; then
-		msg_stopping "Courier IMAP SSL"
-		daemon $libexecdir/imapd-ssl.rc stop
-		RETVAL=$?
-		rm -f /var/lock/subsys/courier-imap-ssl >/dev/null 2>&1
-	else
+
+	msg_stopping "Courier IMAP SSL"
+	daemon $libexecdir/imapd-ssl.rc stop
+	RETVAL=$?
+	rm -f /var/lock/subsys/courier-imap-ssl >/dev/null 2>&1
+}
+
+condrestart() {
+	if [ ! -f /var/lock/subsys/courier-imap-ssl ]; then
 		msg_not_running "Courier IMAP SSL"
+		RETVAL=$1
+		return
 	fi
+
+	stop
+	start
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart)
+	stop
+	start
 	;;
-restart|force-reload)
-	$0 stop
-	$0 start
-	exit $?
+  force-reload)
+	condrestart 7
 	;;
-status)
+  status)
 	# FIXME: matches other services, like courier-imap
 	status couriertcpd
 	exit $?
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/courier-imap/courier-imap-ssl.init?r1=1.5&r2=1.6&f=u



More information about the pld-cvs-commit mailing list