Mail archive
alpine-aports

[alpine-aports] [PATCH] main/lighttpd: upgrade to 1.4.38. initd, confd & logrotate cleanups. all references to /var/run changed to /run

From: Valery Kartel <valery.kartel_at_gmail.com>
Date: Mon, 7 Dec 2015 12:19:20 +0200

---
 main/lighttpd/APKBUILD                          | 29 +++++----
 main/lighttpd/config_insert_values_global.patch | 11 ++++
 main/lighttpd/lighttpd.conf                     |  2 +-
 main/lighttpd/lighttpd.confd                    |  8 ---
 main/lighttpd/lighttpd.initd                    | 82 +++++++------------------
 main/lighttpd/lighttpd.logrotate                | 25 +++-----
 main/lighttpd/mod_fastcgi.conf                  |  2 +-
 7 files changed, 60 insertions(+), 99 deletions(-)
 create mode 100644 main/lighttpd/config_insert_values_global.patch
diff --git a/main/lighttpd/APKBUILD b/main/lighttpd/APKBUILD
index 923229a..b1dceab 100644
--- a/main/lighttpd/APKBUILD
+++ b/main/lighttpd/APKBUILD
_at_@ -1,6 +1,7 @@
+# Contributor: Valery Kartel <valery.kartel_at_gmail.com>
 # Maintainer: Natanael Copa <ncopa_at_alpinelinux.org>
 pkgname=lighttpd
-pkgver=1.4.37
+pkgver=1.4.38
 _streamver=2.2.0
 pkgrel=0
 pkgdesc="a secure, fast, compliant and very flexible web-server"
_at_@ -15,7 +16,7 @@ makedepends="flex pcre-dev openssl-dev zlib-dev bzip2-dev lua-dev
 	automake autoconf openldap-dev libxml2-dev sqlite-dev libev-dev"
 source="http://download.lighttpd.net/lighttpd/releases-1.4.x/$pkgname-$pkgver.tar.xz
 	http://h264.code-shop.com/download/lighttpd-1.4.18_mod_h264_streaming-$_streamver.tar.gz
-
+	config_insert_values_global.patch
 	$pkgname.initd
 	$pkgname.confd
 	$pkgname.logrotate
_at_@ -30,17 +31,18 @@ subpackages="$pkgname-doc $pkgname-dbg $pkgname-mod_auth $pkgname-mod_h264_strea
 
 prepare() {
 	cd "$srcdir"/$pkgname-$pkgver
-	for i in $source; do
-		case $i in
-		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
-		esac
-	done
 
 	# copy over the mod-h264-streaming mod
 	# http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Lighttpd-Version2#DownloadLighttpd1.4.191.4.20andother1.4.x
 	cp "$srcdir"/lighttpd-1.4.18/src/moov.* src/
 	cp "$srcdir"/lighttpd-1.4.18/src/mod_h264_streaming.c src/
 
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+
 	cat >> src/Makefile.am <<__EOF__
 
 lib_LTLIBRARIES += mod_h264_streaming.la
_at_@ -84,9 +86,7 @@ package() {
 	make DESTDIR="$pkgdir" install || return 1
 
 	# create dirs
-	install -d -m755 -o lighttpd -g lighttpd \
-		"$pkgdir"/var/run/lighttpd/ \
-		"$pkgdir"/var/log/lighttpd/ || return 1 
+	install -d -m755 -o lighttpd -g lighttpd "$pkgdir"/var/log/lighttpd
 	install -d -m755 \
 		"$pkgdir"/etc/lighttpd/ \
 		"$pkgdir"/var/www/localhost/htdocs || return 1
_at_@ -131,8 +131,9 @@ mod_webdav() {
 }
 
 
-md5sums="ca40168f54b46ee29475868ced8507d6  lighttpd-1.4.37.tar.xz
+md5sums="7adc12323f37ed24ecf026c7547b577d  lighttpd-1.4.38.tar.xz
 ac37885c881a058194405232e7737a7a  lighttpd-1.4.18_mod_h264_streaming-2.2.0.tar.gz
+6d983018d6c3119e06044b232587ec4b  config_insert_values_global.patch
 b3f7106fa5dcdadf3b0e1bb98bba5e3a  lighttpd.initd
 0dede109282bfe685bdec6b35f0e4b6b  lighttpd.confd
 ad091c9157134890499f26d170352c9f  lighttpd.logrotate
_at_@ -141,8 +142,9 @@ f3353baa4577703ec3a30c03482df986  mime-types.conf
 9c1407e95f62ed22da66c4ef5f69c3b5  mod_cgi.conf
 f3363e39832f1b6678468b482d121afb  mod_fastcgi.conf
 aee5947a1abf380b0685a534ca384b42  mod_fastcgi_fpm.conf"
-sha256sums="804e6f60567ca1da2b3927f92b7e9332b93aca9560f282ca135b86b7558979bd  lighttpd-1.4.37.tar.xz
+sha256sums="4912568b7befcf3f552ca4668bd7f38cd85f42a22944359d00816ec27eb1e504  lighttpd-1.4.38.tar.xz
 732cf98d823f2c7ddc96a3130a3c88d588b02ed20a0e7f8c9be25a265fbea2d6  lighttpd-1.4.18_mod_h264_streaming-2.2.0.tar.gz
+23a341837199f043fc62a64478fa4a3f1064683db3f0ffd2ee184ce0f030daba  config_insert_values_global.patch
 097a4df1a6470e2e9fd2097c7c1daa7b1ee6341faddc35a65e975af019beaebd  lighttpd.initd
 94f69a173dc26610a43532474230537b9bc31ec846fb9f94cb72765f125edf87  lighttpd.confd
 503ee1cd454e2c0f9a212ef60dc8321893eda06ccf721ecbe94d189a09e0bc6c  lighttpd.logrotate
_at_@ -151,8 +153,9 @@ sha256sums="804e6f60567ca1da2b3927f92b7e9332b93aca9560f282ca135b86b7558979bd  li
 322656b4cfd22ca9f1f8ab160e0b932f1646622422fd49c6fc82ab416223eecf  mod_cgi.conf
 d1adc1358b5d9e85353caa2e706bfa231d145dd59c075cdcb3f818b3cb5d722e  mod_fastcgi.conf
 e7eb047360e09d1a2b693f08d4a912b99954090c5bdea706f46a33554e867043  mod_fastcgi_fpm.conf"
-sha512sums="60870149c78a44ae1cf29bd2ba8737ba18019178f9fd3868523255121d85cdc923c2315b572a2a0fcecc3d6451a501ad030189b78bfc7f25807a05b0300063b3  lighttpd-1.4.37.tar.xz
+sha512sums="48db53d7aa1cb8bba9224a97a62e65a33cd22c1d3f2cb08b57df7961e16b373b839678cdf898efbb707ba7bff966587977e7a5d925cfe67ca1531c2778f2326a  lighttpd-1.4.38.tar.xz
 12e1b7c8146cccfa78678ce56cd2f704423559b23b90996dff00602634f110512146386086ac234293a3c28900a06c2bec1c97e680e7eed5173372f88177b351  lighttpd-1.4.18_mod_h264_streaming-2.2.0.tar.gz
+3d4c598f612dedccb64822f345a8748c96bf5c103d4d3bd153d0046669748475ecbf92d3d576d06f88d055a054345847cdb39826330db54452c9d4d71b6ebb98  config_insert_values_global.patch
 69b7574a8d4384bcbbca587aa643aeb55c2b237e726093d1443982d8ec1d085b15c3891a273f7901a9554df4d0842a586d59cc6062b8347e72dad8c6c37bc39a  lighttpd.initd
 93a05dddab14ba6355a0345f1da2fe900c8b55fed8f98506295dc12d96c7cef803c4aca77f016b8acea7bbde485be1e09a57d31fdca6f91023fbeb4db9a90a8b  lighttpd.confd
 e1284fe9ab4b9a53c21b40a5ac3e77e66343e187321b8a2f7464db64747f3a99f7e17a9e7c0e298db84a24fa1286cfe344dbff182eddd9de5c0605f5397a6972  lighttpd.logrotate
diff --git a/main/lighttpd/config_insert_values_global.patch b/main/lighttpd/config_insert_values_global.patch
new file mode 100644
index 0000000..af9fc77
--- /dev/null
+++ b/main/lighttpd/config_insert_values_global.patch
_at_@ -0,0 +1,11 @@
+--- old/src/mod_h264_streaming.c
++++ new/src/mod_h264_streaming.c
+_at_@ -168,7 +168,7 @@
+ 
+     p->config_storage[i] = s;
+ 
+-    if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) {
++    if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) {
+       return HANDLER_ERROR;
+     }
+   }
diff --git a/main/lighttpd/lighttpd.conf b/main/lighttpd/lighttpd.conf
index 2cad775..8111112 100644
--- a/main/lighttpd/lighttpd.conf
+++ b/main/lighttpd/lighttpd.conf
_at_@ -53,7 +53,7 @@ server.username      = "lighttpd"
 server.groupname     = "lighttpd"
 
 server.document-root = var.basedir + "/htdocs"
-server.pid-file      = "/var/run/lighttpd.pid"
+server.pid-file      = "/run/lighttpd/lighttpd.pid"
 
 server.errorlog      = var.logdir  + "/error.log"
 # log errors to syslog instead
diff --git a/main/lighttpd/lighttpd.confd b/main/lighttpd/lighttpd.confd
index 70d4170..e5ab469 100644
--- a/main/lighttpd/lighttpd.confd
+++ b/main/lighttpd/lighttpd.confd
_at_@ -1,12 +1,4 @@
-# /etc/conf.d/lighttpd
-
 # Location of a shell used by the 'include_shell' directive
 # in the lighttpd's configuration file
 #export SHELL="/bin/bash"
 
-# Location of the lighttpd configuration file
-LIGHTTPD_CONF="/etc/lighttpd/lighttpd.conf"
-
-# Location of the lighttpd pid file
-LIGHTTPD_PID="/var/run/lighttpd.pid"
-
diff --git a/main/lighttpd/lighttpd.initd b/main/lighttpd/lighttpd.initd
index 380ed7e..ce6c302 100644
--- a/main/lighttpd/lighttpd.initd
+++ b/main/lighttpd/lighttpd.initd
_at_@ -1,74 +1,34 @@
 #!/sbin/openrc-run
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/lighttpd.initd,v 1.21 2012/01/08 20:45:46 hwoarang Exp $
 
-extra_started_commands="reload graceful"
+pidfile=/run/lighttpd/lighttpd.pid
+configfile=/etc/lighttpd/lighttpd.conf
+command=/usr/sbin/lighttpd
+command_args="-f $configfile $LIGHTTPD_OPTS"
+required_files=$configfile
+extra_started_commands="reload"
 
 depend() {
 	need net
 	use mysql logger spawn-fcgi ldap slapd netmount dns
-	after firewall
-	after famd
-	after sshd
+	after firewall famd sshd
 }
 
-checkconfig() {
-	if [ ! -f "${LIGHTTPD_CONF}" ] ; then
-		ewarn "${LIGHTTPD_CONF} does not exist."
-		return 1
+start_pre() {
+	ebegin
+	$command $command_args -t >/dev/null
+	local ret=$?
+	if [ $ret -eq 0 ]; then
+		local pid=$($command $command_args -p | grep server\.pid-file | cut -d\" -f2)
+		[ "x$pid" != "x" ] && pidfile=$pid
+		user=$($command $command_args -p | grep server\.username | cut -d\" -f2)
+		group=$($command $command_args -p | grep server\.groupname | cut -d\" -f2)
+		checkpath --directory --owner ${user:-lighttpd}:${group:-lighttpd} --mode 0750 ${pidfile%/*}
 	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="/var/run/lighttpd.pid"
-	fi
-	/usr/sbin/lighttpd -t -f ${LIGHTTPD_CONF} >/dev/null
-}
-
-start() {
-	checkconfig || return 1
-	checkpath -d -q -m 0750 -o lighttpd:lighttpd /var/run/lighttpd/
-
-	ebegin "Starting lighttpd"
-	start-stop-daemon --start --quiet --exec /usr/sbin/lighttpd \
-		--pidfile "${LIGHTTPD_PID}" -- -f "${LIGHTTPD_CONF}"
-	eend $?
-}
-
-stop() {
-	local rv=0
-	ebegin "Stopping lighttpd"
-	start-stop-daemon --stop --quiet --pidfile "${LIGHTTPD_PID}"
-	eend $?
+	eend $ret
 }
 
 reload() {
-	if ! service_started "${SVCNAME}" ; then
-		eerror "${SVCNAME} isn't running"
-		return 1
-	fi
-	checkconfig || return 1
-
-	ebegin "Re-opening lighttpd log files"
-	start-stop-daemon --quiet --pidfile "${LIGHTTPD_PID}" \
-		--signal HUP
-	eend $?
-}
-
-graceful() {
-	if ! service_started "${SVCNAME}" ; then
-		eerror "${SVCNAME} isn't running"
-		return 1
-	fi
-	checkconfig || return 1
-
-	ebegin "Gracefully stopping lighttpd"
-	start-stop-daemon --quiet --pidfile "${LIGHTTPD_PID}" \
-		--signal INT
-	if eend $? ; then
-		rm -f "${LIGHTTPD_PID}"
-		start
-	fi
+	ebegin "Reloading ${SVCNAME}"
+	start-stop-daemon --signal HUP --pidfile $pidfile --name $SVCNAME
+	eend
 }
diff --git a/main/lighttpd/lighttpd.logrotate b/main/lighttpd/lighttpd.logrotate
index 76f0ef3..639d675 100644
--- a/main/lighttpd/lighttpd.logrotate
+++ b/main/lighttpd/lighttpd.logrotate
_at_@ -1,17 +1,12 @@
-# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/lighttpd.logrotate,v 1.2 2006/05/30 19:49:29 bangert Exp $
-# lighttpd logrotate script for Gentoo
-
-/var/log/lighttpd/*.log {
-        daily
-        missingok
-		copytruncate
-        rotate 7
-        compress
-        notifempty
-        sharedscripts
-        postrotate
-           if [ -f /var/run/lighttpd.pid ]; then \
-                /etc/init.d/lighttpd reload > /dev/null 2>&1 || true ; \
-           fi;
+/var/log/lighttpd/*log {
+	daily
+	missingok
+	copytruncate
+	rotate 7
+	compress
+	notifempty
+	sharedscripts
+	postrotate
+		/etc/init.d/lighttpd --quiet --ifstarted reload
         endscript
 }
diff --git a/main/lighttpd/mod_fastcgi.conf b/main/lighttpd/mod_fastcgi.conf
index ca1369a..549b84c 100644
--- a/main/lighttpd/mod_fastcgi.conf
+++ b/main/lighttpd/mod_fastcgi.conf
_at_@ -8,7 +8,7 @@ server.modules += ("mod_fastcgi")
 fastcgi.server = ( ".php" =>
 		            ( "localhost" =>
 			            (
-				            "socket"		=>		"/var/run/lighttpd/lighttpd-fastcgi-php-" + PID + ".socket",
+				            "socket"		=>		"/run/lighttpd/lighttpd-fastcgi-php-" + PID + ".socket",
 				            "bin-path"	=>		"/usr/bin/php-cgi"
 			            )
 		            )
-- 
2.6.3
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Mon Dec 07 2015 - 12:19:20 GMT