From a1e16a579f84e76cdb3bbdacbc923d9f0c5d2b59 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Wed, 27 Jan 2010 22:21:09 +0100 Subject: [PATCH] Clean up init file a little bit to prevent errors from grep. --- debian/changelog | 1 + debian/init | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index d796838..ac411a8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ yubikey-server-c (0.5-1) unstable; urgency=low - explicitly link against libgcrypt. Should fix build failure with binutils-gold. Closes: #556920 * Make sure to install sample init file. Closes: #565986 + * Clean up init file a little bit to prevent errors from grep. -- Tollef Fog Heen Wed, 27 Jan 2010 22:15:44 +0100 diff --git a/debian/init b/debian/init index 420da80..99e6a4c 100755 --- a/debian/init +++ b/debian/init @@ -16,13 +16,12 @@ # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="Description of the service" +CONFIGFILE=/etc/yubikeyd.conf NAME=yubikeyd DAEMON=/usr/sbin/$NAME -DAEMON_ARGS="-c /etc/yubikeyd.conf" +DAEMON_ARGS="-c $CONFIGFILE" PIDFILE=/var/run/yubikeyd/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME -U=$(grep ^user= /etc/yubikeyd.conf| cut -d= -f 2) -G=$(grep ^group= /etc/yubikeyd.conf| cut -d= -f 2) # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 @@ -37,6 +36,14 @@ G=$(grep ^group= /etc/yubikeyd.conf| cut -d= -f 2) # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions +if ! [ -r "$CONFIGFILE" ]; then + echo "Configuration file $CONFIGFILE does not exist or is not readable" + exit 1 +fi + +U=$(grep ^user= $CONFIGFILE| cut -d= -f 2) +G=$(grep ^group= $CONFIGFILE| cut -d= -f 2) + # # Function that starts the daemon/service # -- 2.39.5