Mail archive
alpine-aports

[alpine-aports] [PATCH v2] main/mini_httpd: upgrade to 1.26

From: Valery Kartel <valery.kartel_at_gmail.com>
Date: Tue, 7 Feb 2017 11:55:27 +0200

---
cleanups in APKBUILD, init & logrotate scripts
---
v1 -> v2:
add missting mini_httpd.conf
remove pre-upgrade script
remove old compat contents from pre-install
---
 main/mini_httpd/APKBUILD                           | 66 ++++++++++------------
 .../{mini_httpd.conf.sample => mini_httpd.conf}    |  9 +--
 main/mini_httpd/mini_httpd.initd                   | 31 +++++-----
 main/mini_httpd/mini_httpd.logrotate               | 26 ++++-----
 main/mini_httpd/mini_httpd.pre-install             |  7 ---
 main/mini_httpd/mini_httpd.pre-upgrade             |  1 -
 6 files changed, 59 insertions(+), 81 deletions(-)
 rename main/mini_httpd/{mini_httpd.conf.sample => mini_httpd.conf} (88%)
 mode change 100755 => 100644 main/mini_httpd/mini_httpd.initd
 delete mode 120000 main/mini_httpd/mini_httpd.pre-upgrade
diff --git a/main/mini_httpd/APKBUILD b/main/mini_httpd/APKBUILD
index a2de3f3f92..9c9851d7ac 100644
--- a/main/mini_httpd/APKBUILD
+++ b/main/mini_httpd/APKBUILD
_at_@ -1,32 +1,25 @@
 # Maintainer: Natanael Copa <ncopa_at_alpinelinux.org>
 pkgname=mini_httpd
-pkgver=1.25
-pkgrel=2
+pkgver=1.26
+pkgrel=0
 pkgdesc="Small forking webserver with ssl and ipv6 support"
 url="http://www.acme.com/software/mini_httpd/"
 arch="all"
 license="BSD"
-depends="logrotate"
+pkgusers="minihttpd"
+pkggroups="www-data"
+depends=""
 makedepends="libressl-dev"
 subpackages="$pkgname-doc"
-install="$pkgname.pre-install $pkgname.pre-upgrade"
-source="http://www.acme.com/software/mini_httpd/$pkgname-$pkgver.tar.gz
+install="$pkgname.pre-install"
+source="http://www.acme.com/software/$pkgname/$pkgname-$pkgver.tar.gz
 	fix-cgi.patch
-	$pkgname.conf.sample
+	$pkgname.conf
 	$pkgname.initd
 	$pkgname.logrotate
 	"
-
 builddir="$srcdir/$pkgname-$pkgver"
 
-prepare() {
-	default_prepare || return 1
-
-	cd "$builddir"
-	sed -i s:getline:htgetline:g \
-		htpasswd.c || return 1
-}
-
 build() {
 	cd "$builddir"
 	make CFLAGS="${CFLAGS} -DUSE_SSL" \
_at_@ -42,32 +35,33 @@ package() {
 		BINDIR="$pkgdir"/usr/sbin \
 		MANDIR="$pkgdir"/usr/share/man
 
-	# rename htpasswd to mini_htpasswd
-	mv "$pkgdir"/usr/sbin/htpasswd "$pkgdir"/usr/sbin/mini_htpasswd
+	mkdir -p "$pkgdir"/usr/bin \
+		"$pkgdir"/var/log/$pkgname
+
+	# rename sbin/htpasswd to bin/mini_htpasswd
+	mv "$pkgdir"/usr/sbin/htpasswd "$pkgdir"/usr/bin/mini_htpasswd
 	mv "$pkgdir"/usr/share/man/man1/htpasswd.1 \
 		"$pkgdir"/usr/share/man/man1/mini_htpasswd.1
 
-	mkdir -p "$pkgdir"/var/www/localhost/htdocs
-	install -D -m644 ../mini_httpd.conf.sample \
-		"$pkgdir"/etc/mini_httpd/mini_httpd.conf
-	install -D -m755 ../mini_httpd.initd "$pkgdir"/etc/init.d/mini_httpd
-	install -D -m644 ../mini_httpd.logrotate \
-		"$pkgdir"/etc/logrotate.d/mini_httpd
-	install -d "$pkgdir"/var/run/mini_httpd "$pkgdir"/var/log/mini_httpd
+	install -Dm644 "$srcdir"/$pkgname.conf "$pkgdir"/etc/$pkgname/$pkgname.conf
+	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+	install -Dm644 "$srcdir"/$pkgname.logrotate "$pkgdir"/etc/logrotate.d/$pkgname
+
+	install -dm755 -g $pkggroups "$pkgdir"/var/www/localhost/htdocs
 }
 
-md5sums="e3fc3f28526b8cf810eea91a219851a0  mini_httpd-1.25.tar.gz
+md5sums="1dd259c5bd002327334ea98acf8e1e29  mini_httpd-1.26.tar.gz
 eb1c3af0911c74690acfd0d6d4475198  fix-cgi.patch
-9254094233d05a69b2953dd9e8c9ce1c  mini_httpd.conf.sample
-1679e25f17788a8c9be752ff059bbd9b  mini_httpd.initd
-915683e9c7e1cef7ce9b1bbaa31ab680  mini_httpd.logrotate"
-sha256sums="25a0325e698d6bf828ab8089d5ba8835edd7384936cd3074e1543ecafd85958c  mini_httpd-1.25.tar.gz
+0d9864d06ae8d1a788b3c99eeca70096  mini_httpd.conf
+9c04beece4f669d243dad1b13f24dde3  mini_httpd.initd
+600f4fec298eb0a60b91c15601a9ca0d  mini_httpd.logrotate"
+sha256sums="86d56c3e2400d4a2dc004f2a2b1f3b9f7a416b02d414d8e84ab3045cc9a64054  mini_httpd-1.26.tar.gz
 bf67da598db0c4c932e6b512ea657c20c83e67d732a19dcba0c4432922c7a09a  fix-cgi.patch
-bc6fb1d7a1ac42549b469be5dd4368a5afca502562f9488a7061f16d0434d353  mini_httpd.conf.sample
-cae12348aa748a24d52ca51c7846e5af28e3bf3c57c08b5f436b1fb82f4aa0cd  mini_httpd.initd
-e7b4388fc574916b0b4948c60655f55c51a481fe1b2c2f34c55775f0c454bcb5  mini_httpd.logrotate"
-sha512sums="59cbcef642a8c734bf85517958e807d4790b42ed2ab00e1cef1781d391609cf6e5602cfff4a1833423edf5ee2ada5dbd5443aa701e9a626db500cd07c84a6cbb  mini_httpd-1.25.tar.gz
+ec69d06cadf011d615a30057fc89740a7307d25e46c590617abdf1a9d4a43302  mini_httpd.conf
+c9c5e6bdf4ff95428477a17d6e8c1bc5cb560f2ee69de4127d542b7c7ebe2345  mini_httpd.initd
+50adee1e6a99406e61c107e5d88cca6ecefc27d052c1463a35ed8d0daf023ad5  mini_httpd.logrotate"
+sha512sums="d29027df1c5cc3b4f4c91915a729337028372374042d663431e7f0ca0e6bd5b3d1cf1658cc6d2e6f5fa576268e06b81a12fc7b954ccb779645d267c5b180e3e3  mini_httpd-1.26.tar.gz
 0ba18ce425ceb3f9fb18eeec7be2453263d76f81dfcc357fb8bd9d31bd89af69b030fa4d82bfe48441e81625a211e372aa06facd8fccacd5c0f33269a77de71f  fix-cgi.patch
-4ecb6a2686cebfa97ff5f7ab99f6903d43468a01eea9d3e5852f2bcc48f280b538a17acaa30aff05ea4645df8bfa6544082a494452e1eff9745f86460e378411  mini_httpd.conf.sample
-821e775318d7fff1f77dc3bd08ac2095233a9224be424eb796c1d6eae6cea5b1ed99a6b18d367bb120ceff5f5a2026f88c6bc3d54a754120bc68b27ea7c46a49  mini_httpd.initd
-ebaae32d151de8d8f923b0bbfd7a3524d47ee96fce46b46e8f44f5495459828508bb98b3c0250c76bf76e205f61ef4dfc273835731e3edf8e3d51761dd638e3c  mini_httpd.logrotate"
+1e6ef2da61c82ff5e8bb79058c188954d72c69e9d25abdd9bca51f3122aac8729bcfd6e53ae7ee40807b9250698f2cde13dad51ffed962aa07004c7f456f9cb3  mini_httpd.conf
+9daa9052609136a461c912ee2b64829abf2c4c626553a12a3d45c2158be4ed0749126b5ea594fed02a6a4779d7869a073070c259ac28ca19171a168fcbb0632c  mini_httpd.initd
+ba2f8ee2436238a18cc75d3116caafbd244b163c0f8589236abe0584c407076b9f739eba5e7d4faadeb220cce38f1c4fa03d1c2b5f256c1e66428afa8370fdeb  mini_httpd.logrotate"
diff --git a/main/mini_httpd/mini_httpd.conf.sample b/main/mini_httpd/mini_httpd.conf
similarity index 88%
rename from main/mini_httpd/mini_httpd.conf.sample
rename to main/mini_httpd/mini_httpd.conf
index ea14301190..066f72cd13 100644
--- a/main/mini_httpd/mini_httpd.conf.sample
+++ b/main/mini_httpd/mini_httpd.conf
_at_@ -1,8 +1,3 @@
-## /etc/mini_httpd.conf
-##
-## do not leave empty lines in here!
-## format is: key=value
-##
 ## run in debug-mode?
 #debug
 ##
_at_@ -24,8 +19,8 @@ dir=/var/www/localhost/htdocs
 #cgipat=**.sh|**.cgi
 ##
 ## chroot:
-chroot
-#nochroot
+#chroot
+nochroot
 ##
 #logfile=/var/log/mini_httpd/mini_httpd.log
 ##
diff --git a/main/mini_httpd/mini_httpd.initd b/main/mini_httpd/mini_httpd.initd
old mode 100755
new mode 100644
index 91a67ccda3..bd8d62fd60
--- a/main/mini_httpd/mini_httpd.initd
+++ b/main/mini_httpd/mini_httpd.initd
_at_@ -1,32 +1,31 @@
 #!/sbin/openrc-run
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/www-servers/mini_httpd/files/mini_httpd.init,v 1.2 2007/08/26 21:20:21 bangert Exp $
 
 description="Small HTTP server"
+extra_started_commands="reload"
+start_stop_daemon_args="--quiet"
 
-pidfile=/var/run/mini_httpd/${SVCNAME}.pid
+cfgfile=/etc/mini_httpd/$RC_SVCNAME.conf
+pidfile=/run/mini_httpd/$RC_SVCNAME.pid
+command=/usr/sbin/mini_httpd
+required_files="$cfgfile"
 
 depend() {
 	need net
 	after firewall
 }
 
-start() {
-	local logfile=$(awk -F= '$1 == "logfile" { print $2 }' /etc/mini_httpd/${SVCNAME}.conf 2>/dev/null)
-	: ${logfile:=/var/log/mini_httpd/${SVCNAME}.log}
+start_pre() {
+	ebegin
 	checkpath -d ${pidfile%/*}
-	checkpath -d ${logfile%/*}
-	ebegin "Starting $SVCNAME"
-	start-stop-daemon --quiet --start --exec /usr/sbin/mini_httpd \
-		--pidfile $pidfile -- -i $pidfile \
-		${MINI_HTTPD_OPTS:--C /etc/mini_httpd/${SVCNAME}.conf -l ${logfile}}
+	local logfile=$(awk -F= '$1 == "logfile" { print $2 }' $cfgfile 2>/dev/null)
+	[ -n "$logfile" ] && checkpath -d ${logfile%/*}
+	command_args="-i $pidfile -C $cfgfile ${logfile:+-l $logfile} $command_args"
+	$command -V -C $cfgfile >/dev/null
 	eend $?
 }
 
-stop() {
-	ebegin "Stopping $SVCNAME"
-	start-stop-daemon --quiet --stop --pidfile $pidfile
+reload() {
+	ebegin "Reloading $RC_SVCNAME configuration"
+	start-stop-daemon --signal HUP --pidfile $pidfile
 	eend $?
 }
-
diff --git a/main/mini_httpd/mini_httpd.logrotate b/main/mini_httpd/mini_httpd.logrotate
index bbd448b80a..046b19defd 100644
--- a/main/mini_httpd/mini_httpd.logrotate
+++ b/main/mini_httpd/mini_httpd.logrotate
_at_@ -1,16 +1,14 @@
 /var/log/mini_httpd/*.log {
-        weekly
-        missingok
-		copytruncate
-        rotate 7
-        compress
-        notifempty
-        sharedscripts
-        postrotate
-           for i in /var/run/mini_httpd*.pid /var/run/mini_httpd/*.pid; do \
-	   	if [ -f "$i" ]; then \
-                	/etc/init.d/$(basename $i .pid) restart > /dev/null 2>&1 || true ; \
-           	fi; \
-	   done;
-        endscript
+	weekly
+	missingok
+	copytruncate
+	rotate 7
+	compress
+	notifempty
+	sharedscripts
+	postrotate
+	for i in /run/mini_httpd/*.pid; do \
+		/etc/init.d/$(basename $i .pid) --quiet --ifstarted reload \
+	done;
+	endscript
 }
diff --git a/main/mini_httpd/mini_httpd.pre-install b/main/mini_httpd/mini_httpd.pre-install
index c2a9d1f139..226a3c0ced 100644
--- a/main/mini_httpd/mini_httpd.pre-install
+++ b/main/mini_httpd/mini_httpd.pre-install
_at_@ -1,12 +1,5 @@
 #!/bin/sh
 
-# move config if needed and create compat symlink
-if [ -f /etc/mini_httpd.conf ] && ! [ -L /etc/mini_httpd.conf ]; then
-	mkdir -p /etc/mini_httpd
-	mv /etc/mini_httpd.conf /etc/mini_httpd/mini_httpd.conf \
-		&& ln -s mini_httpd/mini_httpd.conf /etc/mini_httpd.conf
-fi
-
 addgroup -S -g 82 www-data 2>/dev/null
 adduser -S -D -H -h /var/www/localhost/htdocs -s /sbin/nologin \
         -g minihttpd minihttpd 2>/dev/null
diff --git a/main/mini_httpd/mini_httpd.pre-upgrade b/main/mini_httpd/mini_httpd.pre-upgrade
deleted file mode 120000
index 19e0fba2a6..0000000000
--- a/main/mini_httpd/mini_httpd.pre-upgrade
+++ /dev/null
_at_@ -1 +0,0 @@
-mini_httpd.pre-install
\ No newline at end of file
-- 
2.11.0
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Tue Feb 07 2017 - 11:55:27 GMT