summaryrefslogtreecommitdiff
path: root/community/squid
diff options
context:
space:
mode:
Diffstat (limited to 'community/squid')
-rw-r--r--community/squid/PKGBUILD105
-rw-r--r--community/squid/squid.cron9
-rw-r--r--community/squid/squid.install26
-rw-r--r--community/squid/squid.pam4
-rw-r--r--community/squid/squid.service13
5 files changed, 157 insertions, 0 deletions
diff --git a/community/squid/PKGBUILD b/community/squid/PKGBUILD
new file mode 100644
index 000000000..b76e30b91
--- /dev/null
+++ b/community/squid/PKGBUILD
@@ -0,0 +1,105 @@
+# $Id: PKGBUILD 94128 2013-07-14 18:31:46Z spupykin $
+# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Contributor: Mark Coolen <mark.coolen@gmail.com>
+# Contributor: Tom Newsom <Jeepster@gmx.co.uk>
+# Contributor: Kevin Piche <kevin@archlinux.org>
+
+pkgname=squid
+pkgver=3.3.8
+pkgrel=1
+pkgdesc='Full-featured Web proxy cache server'
+arch=('x86_64' 'i686')
+url='http://www.squid-cache.org'
+depends=('openssl' 'pam' 'cron' 'perl' 'libltdl')
+makedepends=('libcap' 'krb5')
+license=('GPL')
+options=('emptydirs')
+backup=('etc/squid/squid.conf'
+ 'etc/squid/mime.conf')
+install=$pkgname.install
+source=("http://www.squid-cache.org/Versions/v3/3.3/$pkgname-$pkgver.tar.bz2"
+ 'squid.pam'
+ 'squid.cron'
+ 'squid.service')
+md5sums=('ec1654d28e29bdd2ee342ffb655ecc72'
+ '270977cdd9b47ef44c0c427ab9034777'
+ 'a71425c4951f2e5b640d19e6a5048531'
+ 'ceeb57c69ebb165676219222f109a24e')
+
+prepare() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ # gcc 4.6 doesn't support -fhuge-objects.
+ sed '/^ HUGE_OBJECT_FLAG=/ s/"-fhuge-objects"//' -i configure
+
+ # fix cache_dir, cache_dir size, and effective group.
+ sed '/^DEFAULT_SWAP_DIR/ s@/cache@/cache/squid@' -i src/Makefile.in
+ sed '/^#cache_dir/ s/100/256/
+ /^NAME: cache_effective_group/ {n;n;s/none/proxy/}' -i src/cf.data.pre
+
+ sed -i '1,1i#include <errno.h>' helpers/external_acl/file_userip/ext_file_userip_acl.cc
+
+ for i in \
+ helpers/basic_auth/DB \
+ helpers/log_daemon/DB \
+ helpers/negotiate_auth/kerberos \
+ helpers/external_acl/SQL_session; \
+ do
+ echo -e "#!/bin/sh\nexit 0" >$i/config.test
+ chmod 0755 $i/config.test
+ done
+}
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ ./configure \
+ --prefix=/usr \
+ --sbindir=/usr/bin \
+ --datadir=/usr/share/squid \
+ --sysconfdir=/etc/squid \
+ --libexecdir=/usr/lib/squid \
+ --localstatedir=/var \
+ --with-logdir=/var/log/squid \
+ --with-pidfile=/run/squid.pid \
+ --enable-auth \
+ --enable-auth-basic \
+ --enable-auth-ntlm \
+ --enable-auth-digest \
+ --enable-auth-negotiate \
+ --enable-removal-policies="lru,heap" \
+ --enable-storeio="aufs,ufs,diskd" \
+ --enable-delay-pools \
+ --enable-arp-acl \
+ --enable-ssl \
+ --enable-snmp \
+ --enable-linux-netfilter \
+ --enable-ident-lookups \
+ --enable-useragent-log \
+ --enable-cache-digests \
+ --enable-referer-log \
+ --enable-arp-acl \
+ --enable-htcp \
+ --enable-carp \
+ --enable-epoll \
+ --with-large-files \
+ --enable-arp-acl \
+ --with-default-user=proxy \
+ --enable-async-io \
+ --enable-truncate \
+ --enable-icap-client
+ make
+}
+
+package() {
+ cd "$srcdir"
+
+ make -C "$pkgname-$pkgver" DESTDIR="$pkgdir" install
+ install -Dm755 "$srcdir/squid.cron" "$pkgdir/etc/cron.weekly/squid"
+ install -Dm644 "$srcdir/squid.pam" "$pkgdir/etc/pam.d/squid"
+ install -Dm644 "$srcdir/squid.service" \
+ "$pkgdir/usr/lib/systemd/system/squid.service"
+ rm -rf "$pkgdir/run" "$pkgdir/var/run"
+}
+
+# vim: ts=2 sw=2 et ft=sh
diff --git a/community/squid/squid.cron b/community/squid/squid.cron
new file mode 100644
index 000000000..7425df894
--- /dev/null
+++ b/community/squid/squid.cron
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# exit without error if no pidfile exists
+{ read pid </run/squid.pid; } 2>/dev/null || exit 0
+
+# make sure found PID really is a squid process
+if [ /proc/$pid/exec -ef /usr/bin/squid ]; then
+ /usr/bin/squid -k rotate
+fi
diff --git a/community/squid/squid.install b/community/squid/squid.install
new file mode 100644
index 000000000..a7c76d87a
--- /dev/null
+++ b/community/squid/squid.install
@@ -0,0 +1,26 @@
+post_install() {
+ if [ -z "$(grep ^proxy: /etc/group)" ]; then
+ groupadd -g 15 proxy &>/dev/null
+ fi
+
+ id proxy &>/dev/null || \
+ useradd -u 15 -g proxy -d /var/empty proxy
+
+ chown proxy.proxy var/{cache,log}/squid
+
+# cat << EOF
+#Release notes: http://www.squid-cache.org/Versions/v3/3.1/RELEASENOTES.html
+#EOF
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+pre_remove() {
+ userdel proxy &> /dev/null
+ if [ ! -z "$(grep ^proxy: /etc/group)" ]; then
+ groupdel proxy &>/dev/null
+ fi
+}
+
diff --git a/community/squid/squid.pam b/community/squid/squid.pam
new file mode 100644
index 000000000..df8a8104f
--- /dev/null
+++ b/community/squid/squid.pam
@@ -0,0 +1,4 @@
+#/etc/pam.d/squid
+#
+auth required pam_unix.so
+account required pam_unix.so
diff --git a/community/squid/squid.service b/community/squid/squid.service
new file mode 100644
index 000000000..1db8860e5
--- /dev/null
+++ b/community/squid/squid.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Web Proxy Cache Server
+After=network.target
+
+[Service]
+Type=forking
+PIDFile=/run/squid.pid
+ExecStart=/usr/bin/squid -sYC
+ExecStop=/usr/bin/squid -k shutdown
+ExecReload=/usr/bin/squid -k reconfigure
+
+[Install]
+WantedBy=multi-user.target