www-servers/lighttpd: Improve server.pid-file detection in openrc init script. Bug...
authorMarkos Chandras <hwoarang@gentoo.org>
Wed, 2 Sep 2015 16:58:59 +0000 (17:58 +0100)
committerMarkos Chandras <hwoarang@gentoo.org>
Wed, 2 Sep 2015 17:19:01 +0000 (18:19 +0100)
Package-Manager: portage-2.2.20.1

www-servers/lighttpd/files/lighttpd.confd
www-servers/lighttpd/files/lighttpd.initd

index f3afb07a58e1fa42b8f807d365ad61d632f35f2e..c7733de7e75e9ddbf4d4de5f9dadef8a4102efaa 100644 (file)
@@ -6,7 +6,3 @@
 
 # Location of the lighttpd configuration file
 LIGHTTPD_CONF="/etc/lighttpd/lighttpd.conf"
-
-# Location of the lighttpd pid file
-LIGHTTPD_PID="$(/usr/bin/awk '/^server.pid-file/{s=$3};{sub("\"","",s)};END{print s}' ${LIGHTTPD_CONF})"
-
index 23c0983fd77ca01b054c07da06805c37526262a9..8abe3bae5d2401e6875eaff52138a75092ce4b76 100644 (file)
@@ -5,6 +5,8 @@
 
 extra_started_commands="reload graceful"
 
+LIGHTTPD_PID="$($(which lighttpd) -pf ${LIGHTTPD_CONF} | grep pid | cut -d '=' -f 2 | tr -d \\\" | tr -d [:space:])"
+
 depend() {
        need net
        use mysql logger spawn-fcgi ldap slapd netmount dns
@@ -19,9 +21,10 @@ checkconfig() {
        fi
 
        if [ -z "${LIGHTTPD_PID}" ] ; then
-               ewarn "server.pid-file variable in ${LIGHTTPD_CONF}"
-               ewarn "is not set. Falling back to lighttpd.pid"
-               LIGHTTPD_PID="/run/lighttpd.pid"
+               eerror "server.pid-file variable in ${LIGHTTPD_CONF}"
+               eerror "is not set. Please set this variable properly"
+               eerror "and try again"
+               return 1
        fi
        /usr/sbin/lighttpd -t -f ${LIGHTTPD_CONF} >/dev/null
 }