initial import

This commit is contained in:
2025-06-22 20:39:04 -05:00
commit f8a70886f0
3428 changed files with 302546 additions and 0 deletions

116
squid/PKGBUILD Normal file
View File

@@ -0,0 +1,116 @@
# Maintainer: Jesus E. <heckyel@riseup.net>
pkgname=squid
pkgver=4.13
_debver=$pkgver
_debrel=10
pkgrel=3
pkgdesc="Full-featured Web proxy cache server"
arch=('i686' 'x86_64')
url='http://www.squid-cache.org'
depends=('libressl' 'perl' 'libltdl' 'libcap' 'nettle' 'gnutls' 'libnsl' 'libxml2')
makedepends=('krb5' 'cppunit' 'quilt')
license=('GPL-2')
options=('emptydirs')
backup=('etc/squid/squid.conf'
'etc/squid/cachemgr.conf'
'etc/squid/errorpage.css'
'etc/squid/mime.conf')
install=$pkgname.install
source=("${pkgname}-${pkgver}.tar.xz::https://deb.debian.org/debian/pool/main/s/squid/squid_${pkgver}.orig.tar.xz"
"https://security.debian.org/debian-security/pool/updates/main/s/squid/squid_${_debver}-${_debrel}+deb11u3.debian.tar.xz"
"$pkgname.logrotate"
"$pkgname.initd"
"$pkgname.confd"
"$pkgname.run")
sha512sums=('06807f82ed01e12afe2dd843aa0a94f69c351765b1889c4c5c3da1cf2ecb06ac3a4be6a24a62f04397299c8fc0df5397f76f64df5422ff78b37a9382d5fdf7fc'
'79c25d8ef68e45c3ed263088cd2d6e68f484f576f4f185e4f7609051cdcf5987ee7c5acde5e5d11a13b023deccbd0a2d932962d389181ad111ea920910d6c8b6'
'89a703fa4f21b6c7c26e64a46fd52407e20f00c34146ade0bea0c4b63d050117c0f8e218f2256a1fbf6abb84f4ec9b0472c9a4092ff6e78f07c4f5a25d0892a5'
'6c9948ee452ea80f466da49e313c7ab5250f14c2c9248d0c27e1e176c1d89540dec23e91933057bd17484114c20ea82828ed7e2fea758ea718a67eb99db8a4ef'
'018418d0ef66c9ab5d67a8e68ed6f95c7a04ad2a8a073747f39d9db8e83cf72c685d388a727363788042e45d440a69651ec928ccdeed835915ebc8c676b43519'
'3c27f048f85e506b0d206be4fed035bc9e0d054b4ad5e09fbe7657478aea9ff232434194df324ca563f23672a29afd277766655c4074b62ba00018bc43233a14')
prepare() {
cd "$srcdir/$pkgname-$pkgver"
if [[ ${pkgver%.*} = ${_debver%.*} ]]; then
# Debian patches
export QUILT_PATCHES=debian/patches
export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
export QUILT_DIFF_ARGS='--no-timestamps'
mv "$srcdir"/debian .
# Doesn't apply
rm -v debian/patches/0001-Default-configuration-file-for-debian.patch || true
rm -v debian/patches/0002-Change-default-file-locations-for-debian.patch || true
rm -v debian/patches/0003-installed-binary-for-debian-ci.patch || true
rm -v debian/patches/0005-Use-RuntimeDirectory-to-create-run-squid.patch || true
quilt push -av
fi
}
build() {
cd "$srcdir/$pkgname-$pkgver"
./configure \
--prefix=/usr \
--datadir=/usr/share/squid \
--sysconfdir=/etc/squid \
--libexecdir=/usr/libexec/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,rock" \
--enable-delay-pools \
--enable-arp-acl \
--with-openssl \
--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 \
--enable-ssl-crtd \
--disable-arch-native \
--disable-strict-error-checking \
--enable-wccpv2
make
}
package() {
cd "$srcdir"
make -C "$pkgname-$pkgver" DESTDIR="$pkgdir" install
# initial data and configuration
install -Dm644 "${srcdir}/$pkgname.logrotate" "$pkgdir/etc/logrotate.d/$pkgname"
# license
install -Dm644 "$pkgname-$pkgver/COPYING" -t "$pkgdir/usr/share/licenses/$pkgname"
# services
install -Dm644 "$srcdir/$pkgname.confd" "$pkgdir/etc/conf.d/$pkgname"
install -Dm755 "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname"
install -Dm755 "$srcdir/$pkgname.run" "$pkgdir/etc/sv/$pkgname/run"
# cleanup
rm -rf "$pkgdir/run" "$pkgdir/var/run"
}

12
squid/squid.confd Normal file
View File

@@ -0,0 +1,12 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Config file for /etc/init.d/squid
SQUID_OPTS="-YC"
# Kerberos keytab file to use. This is required if you enable kerberos authentication.
SQUID_KEYTAB=""
# Use max_filedescriptors setting in squid.conf to determine the maximum number
# of filedescriptors squid can open.

118
squid/squid.initd Normal file
View File

@@ -0,0 +1,118 @@
#!/sbin/openrc-run
# Copyright 1999-2014 Gentoo Foundation
# Copyright 2019 Hyperbola Project
# Distributed under the terms of the GNU General Public License v2
extra_started_commands="reload rotate"
depend() {
use dns net
}
checkconfig() {
if [ ! -f /etc/squid/${SVCNAME}.conf ]; then
eerror "You need to create /etc/squid/${SVCNAME}.conf first."
eerror "An example can be found in /etc/squid/squid.conf.default"
return 1
fi
local PIDFILE=$(awk '/^[ \t]*pid_filename[ \t]+/ { print $2 }' < /etc/squid/${SVCNAME}.conf)
[ -z ${PIDFILE} ] && PIDFILE=/run/squid.pid
if [ /run/${SVCNAME}.pid != ${PIDFILE} ]; then
eerror "/etc/squid/${SVCNAME}.conf must set pid_filename to"
eerror " /run/${SVCNAME}.pid"
eerror "CAUTION: http_port, cache_dir and *_log parameters must be different than"
eerror " in any other instance of squid."
return 1
fi
# Maximum file descriptors squid can open is determined by:
# a basic default of N=1024
# ... altered by ./configure --with-filedescriptors=N
# ... overridden on production by squid.conf max_filedescriptors (if,
# and only if, setrlimit() RLIMIT_NOFILE is able to be built+used).
# Since we do not configure hard coded # of filedescriptors anymore,
# there is no need for ulimit calls in the init script.
# Use max_filedescriptors in squid.conf instead.
local CACHE_SWAP=$(awk '/^[ \t]*cache_dir[ \t]+/ { if ( $2 == "rock" ) printf "%s/rock ", $3; else if ( $2 == "coss" ) printf "%s/stripe ", $3; else printf "%s/00 ", $3; }' < /etc/squid/${SVCNAME}.conf)
[ -z "$CACHE_SWAP" ] && CACHE_SWAP="/var/cache/squid/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 proxy ${x%/*}) ; then
eend 1
return 1
fi
local INIT_CACHE_RESPONSE="$(/usr/sbin/squid -z -N -f /etc/squid/${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
}
start() {
checkconfig || return 1
checkpath -d -q -m 0750 -o proxy:proxy /run/${SVCNAME}
ebegin "Starting ${SVCNAME}"
KRB5_KTNAME="${SQUID_KEYTAB}" /usr/sbin/squid ${SQUID_OPTS} -f /etc/squid/${SVCNAME}.conf
eend $? && sleep 1
}
stop() {
ebegin "Stopping ${SVCNAME}"
if /usr/sbin/squid -k shutdown -f /etc/squid/${SVCNAME}.conf ; then
# Now we have to wait until squid has _really_ stopped.
sleep 1
if [ -f /run/${SVCNAME}.pid ] ; then
einfon "Waiting for squid to shutdown ."
cnt=0
while [ -f /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 "Squid shutdown failed, probably service is already down."
fi
eend 0
}
reload() {
checkconfig || return 1
ebegin "Reloading ${SVCNAME}"
/usr/sbin/squid -k reconfigure -f /etc/squid/${SVCNAME}.conf
eend $?
}
rotate() {
service_started ${SVCNAME} || return 1
ebegin "Rotating ${SVCNAME} logs"
/usr/sbin/squid -k rotate -f /etc/squid/${SVCNAME}.conf
eend $?
}

22
squid/squid.install Normal file
View File

@@ -0,0 +1,22 @@
post_install() {
if ! getent group proxy &>/dev/null; then
groupadd -g 15 proxy &>/dev/null
fi
if ! getent passwd proxy &>/dev/null; then
useradd -u 15 -g proxy -d /var/empty proxy
fi
chown proxy.proxy var/{cache,log}/squid
}
post_upgrade() {
post_install
}
post_remove() {
if getent passwd proxy &>/dev/null; then
userdel proxy >/dev/null
fi
if getent group proxy &>/dev/null; then
groupdel proxy >/dev/null
fi
}

11
squid/squid.logrotate Normal file
View File

@@ -0,0 +1,11 @@
/var/log/squid/*.log {
daily
compress
rotate 5
missingok
nocreate
sharedscripts
postrotate
/usr/sbin/squid -k rotate
endscript
}

4
squid/squid.run Normal file
View File

@@ -0,0 +1,4 @@
#!/bin/sh -e
install -o proxy -g proxy -m 0755 -d /var/run/squid
squid -N -s -z
exec chpst -U proxy:proxy squid -N -s