77ef929fa4
- integrate most of the vendor patches available from <http://www.squid-cache.org/Versions/v2/2.6/changesets/> up to changeset 11066 - replace the FTP mirror at progeny.com (which seems to be gone and is no longer listed on <http://www.squid-cache.org/Mirrors/ftp-mirrors.html>) with the one hosted by Vistech - remove a redundant / from PATCH_SITE_SUBDIR - update the ICAP patchsets to current ICAP CVS - add an extra patch that adds a decription of how to remap the threading library to the documentation of the aufs file system in squid.conf when Squid is built with aufs support on FreeBSD >= 5.1 - make the rc script pass ${squid_flags} in the shutdown and reconfigure case (ports/100510) - fix a path description in pkg-message (pointed out by "Tuc at the Beach House") - use "Squid" in the pseudo-user's description, too PR: ports/105022 Submitted by: Thomas-Martin Seck <tmseck@netcologne.de> (maintainer) Sponsored by: FreeBSD Bug-a-thon #2
82 lines
2.2 KiB
Bash
82 lines
2.2 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
PATH=/bin:/usr/bin:/usr/sbin
|
|
pkgname=$1
|
|
squid_base="${PKG_PREFIX:-%%PREFIX%%}/squid"
|
|
squid_confdir="${PKG_PREFIX:-%%PREFIX%%}/etc/squid"
|
|
if [ -x /usr/sbin/nologin ]; then
|
|
nologin=/usr/sbin/nologin
|
|
else
|
|
nologin=/sbin/nologin
|
|
fi
|
|
squid_user="%%SQUID_UID%%"
|
|
squid_group="%%SQUID_GID%%"
|
|
squid_gid=100
|
|
squid_uid=100
|
|
case $2 in
|
|
PRE-INSTALL)
|
|
echo "===> Pre-installation configuration for ${pkgname}"
|
|
if ! pw groupshow ${squid_group} -q >/dev/null ; then
|
|
echo "There is no group '${squid_group}' on this system, so I will try to create it (using group id ${squid_gid}):"
|
|
if ! pw groupadd ${squid_group} -g ${squid_gid} -q ; then
|
|
echo "Failed to create group \"${squid_group}\"!" >&2
|
|
echo "Please create it manually." >&2
|
|
exit 1
|
|
else
|
|
echo "Group '${squid_group}' created successfully:"
|
|
fi
|
|
else
|
|
echo "I will use the existing group '${squid_group}':"
|
|
fi
|
|
pw groupshow ${squid_group}
|
|
|
|
if ! pw usershow ${squid_user} -q >/dev/null ; then
|
|
echo "There is no account '${squid_user}' on this system, so I will try to create it (using user id ${squid_uid}):"
|
|
if ! pw useradd -q -n ${squid_user} \
|
|
-u ${squid_uid} -g ${squid_group} \
|
|
-c "Squid caching-proxy pseudo user" \
|
|
-d "${squid_base}" -s "${nologin}" \
|
|
-h - ; then
|
|
echo "Failed to create user '${squid_user}'!" >&2
|
|
echo "Please create it manually." >&2
|
|
exit 1
|
|
else
|
|
echo "User '${squid_user}' created successfully:"
|
|
fi
|
|
else
|
|
echo "I will use the existing user '${squid_user}':"
|
|
fi
|
|
pw usershow ${squid_user}
|
|
for dir in cache logs; do
|
|
if [ ! -d ${squid_base}/${dir} ]; then
|
|
echo "Creating ${squid_base}/${dir}..."
|
|
install -d -o ${squid_user} -g ${squid_group} \
|
|
-m 0750 ${squid_base}/${dir}
|
|
fi
|
|
done
|
|
if [ ! -d ${squid_confdir} ]; then
|
|
echo "Creating ${squid_confdir}..."
|
|
install -d -o root -g ${squid_group} \
|
|
-m 0750 ${squid_confdir}
|
|
fi
|
|
;;
|
|
POST-INSTALL)
|
|
for file in cachemgr.conf mime.conf squid.conf; do
|
|
if [ ! -f ${squid_confdir}/${file} \
|
|
-a -f ${squid_confdir}/${file}.default ]; then
|
|
echo "Creating ${file} from default..."
|
|
install -c -o root -g ${squid_group} -m 0640 \
|
|
${squid_confdir}/${file}.default \
|
|
${squid_confdir}/${file}
|
|
fi
|
|
done
|
|
;;
|
|
*)
|
|
exit 64
|
|
;;
|
|
esac
|
|
exit 0
|