/etc/init/squid-deb-proxy.conf is in squid-deb-proxy 0.6.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | # squid-deb-proxy - a proxy for deb packages
#
description "squid-deb-proxy"
env AVAHIFILE=/etc/avahi/services/squid-deb-proxy.service
pre-start script
concat_file_from_dir() {
# the .d directory
DIR="$1"
# the target file
FILE="$2"
# (optional) additional file append to $FILE
ADDITIONAL_FILE_TO_CAT="$3"
cat > $FILE <<EOF
# WARNING: this file is auto-generated from the files in
# $DIR
# on squid-deb-proxy (re)start, do NOT edit here
EOF
if [ -n "$ADDITIONAL_FILE_TO_CAT" ]; then
cat "$ADDITIONAL_FILE_TO_CAT" >> "$FILE"
fi
for f in "$DIR"/*; do
cat "$f" >> "$FILE"
done
}
if [ -x /usr/sbin/squid ]; then
SQUID=/usr/sbin/squid
elif [ -x /usr/sbin/squid3 ]; then
SQUID=/usr/sbin/squid3
else
echo "No squid binary found"
exit 1
fi
# ensure all cache dirs are there
install -d -o proxy -g proxy -m 750 /var/cache/squid-deb-proxy/
install -d -o proxy -g proxy -m 750 /var/log/squid-deb-proxy/
if [ ! -d /var/cache/squid-deb-proxy/00 ]; then
$SQUID -z -f /etc/squid-deb-proxy/squid-deb-proxy.conf
fi
# generate pkg blacklist acl file
PKG_BLACKLIST_DIR=/etc/squid-deb-proxy/pkg-blacklist.d
PKG_BLACKLIST=/etc/squid-deb-proxy/autogenerated/pkg-blacklist-regexp.acl
concat_file_from_dir "$PKG_BLACKLIST_DIR" "$PKG_BLACKLIST"
# postprocess for regexp format
sed -i -r '/^#/d;/^$/d;s#(.*)#\/\1_.*\.deb$#g' $PKG_BLACKLIST
# generate mirror file
MIRROR_DESTDOMAIN_DIR=/etc/squid-deb-proxy/mirror-dstdomain.acl.d
MIRROR_DESTDOMAIN=/etc/squid-deb-proxy/autogenerated/mirror-dstdomain.acl
concat_file_from_dir "$MIRROR_DESTDOMAIN_DIR" "$MIRROR_DESTDOMAIN" "/etc/squid-deb-proxy/mirror-dstdomain.acl"
# generate the allowed-networks file
ALLOWED_NETWORKS_DIR=/etc/squid-deb-proxy/allowed-networks-src.acl.d
ALLOWED_NETWORKS=/etc/squid-deb-proxy/autogenerated/allowed-networks-src.acl
concat_file_from_dir "$ALLOWED_NETWORKS_DIR" "$ALLOWED_NETWORKS" "/etc/squid-deb-proxy/allowed-networks-src.acl"
end script
post-start script
# create avahi service
PORT=$(grep http_port /etc/squid-deb-proxy/squid-deb-proxy.conf|cut -d' ' -f2)
if [ -n "$PORT" ] && [ -d /etc/avahi/services/ ]; then
cat > $AVAHIFILE << EOF
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">Squid deb proxy on %h</name>
<service protocol="ipv4">
<type>_apt_proxy._tcp</type>
<port>$PORT</port>
</service>
</service-group>
EOF
fi
end script
# if this is done in pre-stop "restart squid-deb-proxy" kills the
# file without putting a replacement in!
post-stop script
if [ -f $AVAHIFILE ]
then
rm $AVAHIFILE
fi
end script
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]
script
if [ -x /usr/sbin/squid ]; then
SQUID=/usr/sbin/squid
elif [ -x /usr/sbin/squid3 ]; then
SQUID=/usr/sbin/squid3
else
echo "No squid binary found"
exit 1
fi
exec $SQUID -N -f /etc/squid-deb-proxy/squid-deb-proxy.conf
end script
|