From d908f60893f296639d2a990e3548bf6b6e54b370 Mon Sep 17 00:00:00 2001 From: Diaz Devera Victor Date: Mon, 22 Dec 2014 00:09:01 -0430 Subject: testing/lusca: new aport --- testing/lusca/APKBUILD | 116 ++++++++++++++++++++++++++++++++++++++ testing/lusca/alpine.patch | 43 ++++++++++++++ testing/lusca/lusca.confd | 4 ++ testing/lusca/lusca.initd | 120 ++++++++++++++++++++++++++++++++++++++++ testing/lusca/lusca.logrotate | 11 ++++ testing/lusca/lusca.pre-install | 6 ++ testing/lusca/lusca.pre-upgrade | 6 ++ 7 files changed, 306 insertions(+) create mode 100644 testing/lusca/APKBUILD create mode 100644 testing/lusca/alpine.patch create mode 100644 testing/lusca/lusca.confd create mode 100644 testing/lusca/lusca.initd create mode 100644 testing/lusca/lusca.logrotate create mode 100644 testing/lusca/lusca.pre-install create mode 100644 testing/lusca/lusca.pre-upgrade (limited to 'testing/lusca') diff --git a/testing/lusca/APKBUILD b/testing/lusca/APKBUILD new file mode 100644 index 0000000000..59bceb1669 --- /dev/null +++ b/testing/lusca/APKBUILD @@ -0,0 +1,116 @@ +# Maintainer: Diaz Devera Victor + +pkgname=lusca +pkgver=r14942 +pkgrel=0 +pkgdesc="A full-featured Web proxy cache server Fork from Squid 2 series." +url="https://code.google.com/p/lusca-cache/" +install="lusca.pre-install lusca.pre-upgrade" +pkgusers="lusca" +pkggroups="lusca" +arch="all" +license="GPL-2" +depends="logrotate" +makedepends="openssl-dev perl-dev autoconf automake heimdal-dev libtool libcap-dev" +subpackages="$pkgname-doc" +linguas="Armenian Czech Estonian Greek Japanese Portuguese Serbian Swedish Ukrainian-koi8-u +Azerbaijani Danish Finnish Hebrew Korean Romanian Simplify_Chinese Traditional_Chinese Ukrainian-utf8 +Bulgarian Dutch French Hungarian Lithuanian Russian-1251 Slovak Turkish templates +Catalan English German Italian Polish Russian-koi8-r Spanish Ukrainian-1251" +langdir="/usr/share/lusca/errors" + +source="https://xvk988.googlecode.com/files/LUSCA_HEAD-r14942.tar.bz2 + alpine.patch + $pkgname.initd + $pkgname.confd + $pkgname.logrotate" + +_builddir="$srcdir"/LUSCA_HEAD-$pkgver + +prepare() { + cd "$_builddir" + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; + esac + done + ./bootstrap.sh + find -name config.sub | xargs chmod u+w +} + +build() { + cd "$_builddir" + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --exec_prefix=/usr \ + --bindir=/usr/sbin \ + --sbindir=/usr/sbin \ + --libexecdir=/usr/lib/$pkgname \ + --sysconfdir=/etc/lusca \ + --localstatedir=/var/spool/$pkgname \ + --datadir=/usr/share/$pkgname \ + --enable-async-io=24 \ + --with-aufs-threads=24 \ + --with-pthreads \ + --enable-storeio=aufs \ + --enable-linux-netfilter \ + --enable-arp-acl \ + --enable-epoll \ + --enable-removal-policies=lru,heap \ + --with-aio \ + --with-dl \ + --enable-snmp \ + --enable-delay-pools \ + --enable-htcp \ + --enable-cache-digests \ + --disable-unlinkd \ + --enable-large-cache-files \ + --with-large-files \ + --enable-auth=basic,digest,ntlm,negotiate \ + --enable-referer-log \ + --enable-follow-x-forwarded-for \ + --with-maxfd=65536 \ + || return 1 + make || return 1 +} + +package() { + cd "$_builddir" + make DESTDIR="$pkgdir" install + install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname + install -m644 -D "$srcdir"/$pkgname.logrotate \ + "$pkgdir"/etc/logrotate.d/$pkgname + install -d -o lusca -g lusca \ + "$pkgdir"/var/cache/$pkgname \ + "$pkgdir"/var/log/$pkgname \ + "$pkgdir"/var/run/$pkgname + + mv "$pkgdir"/etc/lusca/squid.conf.default "$pkgdir"/etc/lusca/$pkgname.conf.default + mv "$pkgdir"/etc/lusca/squid.conf.clean "$pkgdir"/etc/lusca/$pkgname.conf.clean + mv "$pkgdir"/etc/lusca/squid.conf "$pkgdir"/etc/lusca/$pkgname.conf + + mv "$pkgdir"/usr/sbin/squid "$pkgdir"/usr/sbin/$pkgname + mv "$pkgdir"/usr/sbin/squidclient "$pkgdir"/usr/sbin/luscaclient + chmod +x "$pkgdir"/usr/lib/$pkgname/* +} + +md5sums="25d852d20372ad9ba623ca3eb6d7e44a LUSCA_HEAD-r14942.tar.bz2 +c06fc0964158f36578c86d8c262267d4 alpine.patch +ab9c58c553b803ae0f2f3cea2afd102e lusca.confd +bbad1a149da4d1b0d5b1d54ce715ec09 lusca.initd +54fbba7f7795a69e6df66b0c7f36c78d lusca.logrotate" + +sha256sums="0cbf6c1908d62e8d5538f0144a970440b8315089e770d3653bed6757a5602d12 LUSCA_HEAD-r14942.tar.bz2 +c8954f28f7b1f8fa304558b534b6ba3666a1fcfee2624b3195e66c2d86193d52 alpine.patch +2fff1bee04477eaa21d6d4d45b9c4b30a21f10a319ea8b64c7ff52eb9de45ff2 lusca.confd +8b7ece5c63840716e451fe7bfd0bff8c38e98ba9510dc84d1ed6282521ae5625 lusca.initd +b7dc2c4cf17c0088827298d13e419891a9c52b96afcecf49f764fb8bb16fc234 lusca.logrotate" + +sha512sums="60abf830cf07318a772f86c68672a549a804861962b29f9626ec7362369515ba4794b32d66d31ae50ac2e3a3b9520cc1226d0cdf99e5e70c86d4cee622b640b8 LUSCA_HEAD-r14942.tar.bz2 +b216a67f5809fe7b2ebd8a741f500338dc480bbf6b3768c78db0418f3b99fc93e9d1b61a668b2e4276deeeabeeb89dbb4a25473eafb21afbe5f610cf314c0ece alpine.patch +8ce68ccf7b5ada41deea44febebff4aa854bfc4f7797435465afe55055e2fd3c46abe7f753cbfd0135537c44cfe8589cc673e254844e9a60c49c4178c2ec7335 lusca.confd +e768a2b95d9411c80114d1b87b231028556aa60826ff90812a0bdbf21174ac9f5510a2da6b9f21b50b16c263146a4e3af1219422dff49b73e78a6a59f44371cf lusca.initd +785475dbbcd03aa4aaa635ae5aeb5f0682004002ec93036054c3092db5c7c109bbc93b5f3109a690515a89554993cc6d36b9fdc655369a837004a39bb0c12ed4 lusca.logrotate" diff --git a/testing/lusca/alpine.patch b/testing/lusca/alpine.patch new file mode 100644 index 0000000000..e138f915a5 --- /dev/null +++ b/testing/lusca/alpine.patch @@ -0,0 +1,43 @@ +Description:minor corrections to compile in Alpine Linux +Author: Diaz Devera Victor +Last-Update: 2014-09-15 + +--- a/libcore/kb.h ++++ b/libcore/kb.h +@@ -1,6 +1,6 @@ + #ifndef __LIBCORE_KB_H__ + #define __LIBCORE_KB_H__ +- ++#include + + /* + * XXX this strictly shouldn't be here! +--- a/libcore/tools.h ++++ b/libcore/tools.h +@@ -1,5 +1,6 @@ + #ifndef __LIBCORE_TOOLS_H__ + #define __LIBCORE_TOOLS_H__ ++#include + + #define MB ((size_t)1024*1024) + extern double toMB(size_t size); +--- a/libmem/MemPool.h ++++ b/libmem/MemPool.h +@@ -1,5 +1,6 @@ + #ifndef __LIBMEM_MEMPOOL_H__ + #define __LIBMEM_MEMPOOL_H__ ++#include + + /* object to track per-action memory usage (e.g. #idle objects) */ + struct _MemMeter { +--- a/src/acl.c ++++ b/src/acl.c +@@ -3176,7 +3176,7 @@ + #if defined(_SQUID_NETBSD_) || defined(_SQUID_OPENBSD_) + #undef free + #endif +-#include ++#include + #endif + #ifdef _SQUID_LINUX_ + #include diff --git a/testing/lusca/lusca.confd b/testing/lusca/lusca.confd new file mode 100644 index 0000000000..83a53bad06 --- /dev/null +++ b/testing/lusca/lusca.confd @@ -0,0 +1,4 @@ +# Config file for /etc/init.d/lusca + +LUSCA_OPTS="-YCD" + diff --git a/testing/lusca/lusca.initd b/testing/lusca/lusca.initd new file mode 100644 index 0000000000..dfe98bcca2 --- /dev/null +++ b/testing/lusca/lusca.initd @@ -0,0 +1,120 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/files/squid.initd-r3,v 1.1 2013/01/11 15:25:49 eras Exp $ + +extra_started_commands="reload rotate" + +depend() { + use dns + need net + after firewall +} + +checkconfig() { + if [ ! -f /etc/lusca/${SVCNAME}.conf ]; then + eerror "You need to create /etc/lusca/${SVCNAME}.conf first." + eerror "An example can be found in /etc/lusca/lusca.conf.default" + return 1 + fi + + local PIDFILE=$(awk '/^[ \t]*pid_filename[ \t]+/ { print $2 }' < /etc/lusca/${SVCNAME}.conf) + [ -z ${PIDFILE} ] && PIDFILE=/var/run/lusca.pid + if [ /var/run/${SVCNAME}.pid != ${PIDFILE} ]; then + eerror "/etc/lusca/${SVCNAME}.conf must set pid_filename to" + eerror " /var/run/${SVCNAME}.pid" + eerror "CAUTION: http_port, cache_dir and *_log parameters must be different than" + eerror " in any other instance of lusca." + return 1 + fi + + local CACHE_SWAP=$(awk '/^[ \t]*cache_dir[ \t]+/ { if ($2 == "coss" ) printf "%s/stripe ", $3 ; else printf "%s/00 ", $3; }' < /etc/lusca/${SVCNAME}.conf) + [ -z "$CACHE_SWAP" ] && CACHE_SWAP="/var/cache/lusca/00" + + local x + for x in $CACHE_SWAP ; do + if [ ! -e $x ] ; then + ebegin "Initializing cache directory ${x%/*}" + local ORIG_UMASK=$(umask) + umask 027 + + if ! (mkdir -p ${x%/*} && chown lusca ${x%/*}) ; then + eend 1 + return 1 + fi + + local INIT_CACHE_RESPONSE="$(/usr/sbin/lusca -z -N -f /etc/lusca/${SVCNAME}.conf 2>&1)" + if [ $? != 0 ] || echo "$INIT_CACHE_RESPONSE" | grep -q "erminated abnormally" ; then + umask $ORIG_UMASK + eend 1 + echo "$INIT_CACHE_RESPONSE" + return 1 + fi + + umask $ORIG_UMASK + eend 0 + break + fi + done + + return 0 +} + +limits() { + ulimit -c unlimited + ulimit -d unlimited + ulimit -f unlimited + ulimit -n 819200 + ulimit -v unlimited + ulimit -s 8192 + ulimit -l unlimited +} + +start() { + checkconfig || return 1 + ebegin "Starting ${SVCNAME}" + limits + KRB5_KTNAME="${LUSCA_KEYTAB}" /usr/sbin/lusca ${LUSCA_OPTS} -f /etc/lusca/${SVCNAME}.conf + eend $? && sleep 1 +} + +stop() { + ebegin "Stopping ${SVCNAME}" + if /usr/sbin/lusca -k shutdown -f /etc/lusca/${SVCNAME}.conf ; then + # Now we have to wait until lusca has _really_ stopped. + sleep 1 + if [ -f /var/run/${SVCNAME}.pid ] ; then + einfon "Waiting for lusca to shutdown ." + cnt=0 + while [ -f /var/run/${SVCNAME}.pid ] ; do + cnt=$(expr $cnt + 1) + if [ $cnt -gt 60 ] ; then + # Waited 120 seconds now. Fail. + echo + eend 1 "Failed." + break + fi + sleep 2 + echo -n "." + done + echo + fi + else + eerror "lusca shutdown failed, probably service is already down." + fi + eend 0 +} + +reload() { + checkconfig || return 1 + ebegin "Reloading ${SVCNAME}" + /usr/sbin/lusca -k reconfigure -f /etc/lusca/${SVCNAME}.conf + eend $? +} + +rotate() { + service_started ${SVCNAME} || return 1 + ebegin "Rotating ${SVCNAME} logs" + /usr/sbin/lusca -k rotate -f /etc/lusca/${SVCNAME}.conf + eend $? +} diff --git a/testing/lusca/lusca.logrotate b/testing/lusca/lusca.logrotate new file mode 100644 index 0000000000..348e53cdfc --- /dev/null +++ b/testing/lusca/lusca.logrotate @@ -0,0 +1,11 @@ +/var/log/lusca/*.log { + daily + compress + rotate 5 + missingok + nocreate + sharedscripts + postrotate + /usr/sbin/lusca -k rotate + endscript +} diff --git a/testing/lusca/lusca.pre-install b/testing/lusca/lusca.pre-install new file mode 100644 index 0000000000..2ed0cc5cf7 --- /dev/null +++ b/testing/lusca/lusca.pre-install @@ -0,0 +1,6 @@ +#!/bin/sh + +adduser -S -D lusca -h /var/cache/lusca -s /sbin/nologin 2>/dev/null +addgroup winbind 2>/dev/null +addgroup lusca winbind +exit 0 diff --git a/testing/lusca/lusca.pre-upgrade b/testing/lusca/lusca.pre-upgrade new file mode 100644 index 0000000000..2ed0cc5cf7 --- /dev/null +++ b/testing/lusca/lusca.pre-upgrade @@ -0,0 +1,6 @@ +#!/bin/sh + +adduser -S -D lusca -h /var/cache/lusca -s /sbin/nologin 2>/dev/null +addgroup winbind 2>/dev/null +addgroup lusca winbind +exit 0 -- cgit v1.2.3