[Pkg-silc-commits] r123 - /silc-server/trunk/debian/init.d

lunar at users.alioth.debian.org lunar at users.alioth.debian.org
Mon Jul 2 00:44:55 UTC 2007


Author: lunar
Date: Mon Jul  2 00:44:55 2007
New Revision: 123

URL: http://svn.debian.org/wsvn/pkg-silc/?sc=1&rev=123
Log:
Don't start silcd when there is no config file or no private key file.

Modified:
    silc-server/trunk/debian/init.d

Modified: silc-server/trunk/debian/init.d
URL: http://svn.debian.org/wsvn/pkg-silc/silc-server/trunk/debian/init.d?rev=123&op=diff
==============================================================================
--- silc-server/trunk/debian/init.d (original)
+++ silc-server/trunk/debian/init.d Mon Jul  2 00:44:55 2007
@@ -19,9 +19,23 @@
 DAEMON=/usr/sbin/$NAME
 PIDFILE=/var/run/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME
+CONFIGFILE=/etc/$NAME/$NAME.conf
 
 # Exit if the package is not installed
 [ -x "$DAEMON" ] || exit 0
+
+# Exit if configuration file is not readable
+[ -r "$CONFIGFILE" ] || exit 0
+
+read_config() {
+    PARAMETER="$1"
+    sed -n -e "s/^[^#]*$PARAMETER  *=  *\"\([^\"]*\)\".*$/\1/p" "$CONFIGFILE"
+}
+
+PRIVATE_KEY="$(read_config PrivateKey)"
+
+# Exit if private key is not readable
+[ -r "$PRIVATE_KEY" ] || exit 0
 
 # Load the VERBOSE setting and other rcS variables
 . /lib/init/vars.sh




More information about the Pkg-silc-commits mailing list