aboutsummaryrefslogtreecommitdiff
path: root/www/squid/pkg-install
diff options
context:
space:
mode:
authorSergei Kolobov <sergei@FreeBSD.org>2004-03-17 07:06:46 +0000
committerSergei Kolobov <sergei@FreeBSD.org>2004-03-17 07:06:46 +0000
commita0c6cf9fc487d7411215bd26244da5cacab079b3 (patch)
tree7e482a5d8fa0b8cd2433192ead17b7871299f520 /www/squid/pkg-install
parent2c0949bf8ea2a1d82e2c9995ade35dd2f6e0e7fc (diff)
downloadports-a0c6cf9fc487d7411215bd26244da5cacab079b3.tar.gz
ports-a0c6cf9fc487d7411215bd26244da5cacab079b3.zip
- update to squid-2.5.STABLE5, including two vendor patches issued so far
- provide more OPTIONS, including (untested) support for pf(4) - integrate the follow-XFF-patch from devel.squid-cache.org (submitted by Michael Ranner), this should improve interaction with dansguardian - use id 100 for the squid pseudo user instead of choosing the first free id greater than 3127, a behaviour introduced with PORTVERSION 2.5.4_6. Provide a 'changeuser' target to make migration from a high id to id 100 possible (requested by Kris Kennaway) - don't let the port CONFLICT with itself (criticized by Oliver Eikemeier) - provide rcNG support in squid.sh only on systems with /etc/rc.subr PR: ports/64061 Submitted by: Thomas-Martin Seck (maintainer)
Notes
Notes: svn path=/head/; revision=104252
Diffstat (limited to 'www/squid/pkg-install')
-rw-r--r--www/squid/pkg-install69
1 files changed, 60 insertions, 9 deletions
diff --git a/www/squid/pkg-install b/www/squid/pkg-install
index ed7fd6d9c992..35a034c778ce 100644
--- a/www/squid/pkg-install
+++ b/www/squid/pkg-install
@@ -9,16 +9,19 @@ squid_base=${PKG_PREFIX:-/usr/local}/squid
squid_confdir=${PKG_PREFIX:-/usr/local}/etc/squid
squid_user=${SQUID_USER:=squid}
squid_group=${SQUID_GROUP:=squid}
-squid_gid=3128
-squid_uid=3128
-
+squid_gid=100
+squid_uid=100
+# Try to catch the case where the $squid_user might have been created with an
+# id greater than or equal 3128. The valid exception is "nobody".
+nobody_uid=65534
+nobody_gid=65534
+squid_oldgid=3128
+squid_olduid=3128
+unset wrong_id
case $2 in
PRE-INSTALL)
echo "===> Pre-installation configuration for ${pkgname}"
if ! pw groupshow ${squid_group} -q >/dev/null ; then
- while pw groupshow -g ${squid_gid} -q >/dev/null; do
- squid_gid=`expr ${squid_gid} + 1`
- done
echo "There is no group '${squid_group}' on this system, so I will try to create it:"
if ! pw groupadd ${squid_group} -g ${squid_gid} -q ; then
echo "Failed to create group \"${squid_group}\"!" >&2
@@ -29,12 +32,15 @@ PRE-INSTALL)
fi
else
echo "I will use the existing group '${squid_group}':"
+ current_gid=`pw groupshow ${squid_group}|cut -f 3 -d :`
+ if [ ${current_gid} -ge ${squid_oldgid} \
+ -a ${current_gid} -ne ${nobody_gid} ]; then
+ wrong_id=1
+ fi
fi
pw groupshow ${squid_group}
+
if ! pw usershow ${squid_user} -q >/dev/null ; then
- while pw usershow -u ${squid_uid} -q >/dev/null; do
- squid_uid=`expr ${squid_uid} + 1`
- done
echo "There is no account '${squid_user}' on this system, so I will try to create it:"
if ! pw useradd ${squid_user} -u ${squid_uid} -q \
-c "squid caching-proxy pseudo user" -g ${squid_group} \
@@ -47,8 +53,53 @@ PRE-INSTALL)
fi
else
echo "I will use the existing user '${squid_user}':"
+ current_uid=`id -u ${squid_user}`
+ if [ ${current_uid} -ge ${squid_olduid} \
+ -a ${current_uid} -ne ${nobody_uid} ];
+ then
+ wrong_id=1
+ fi
fi
pw usershow ${squid_user}
+ if [ "${wrong_id}" ]; then
+ echo ""
+ echo " * NOTICE *"
+ echo ""
+ echo "The squid pseudo-user's uid and/or gid have been found"
+ echo "to be greater than or equal 3128."
+ echo ""
+ echo "This is not a problem as such, but violates the FreeBSD"
+ echo "ports' principle that a ports must not claim a uid greater"
+ echo "than 999."
+ echo ""
+ echo "Since version 2.5.4_11, the squid user is thus created"
+ echo "with an id of ${squid_uid}:${squid_gid} while earlier versions of this"
+ echo "port used the first unused uid/gid greater than or"
+ echo "equal 3128."
+ echo ""
+ echo "If you want to change the existing squid user's id, run"
+ echo "'make changeuser' after the installation has completed."
+ echo "If you installed this port via a package, issue the"
+ echo "following commands as root:"
+ echo ""
+ echo "pw userdel -u ${current_uid}"
+ echo "pw groupadd -n ${squid_group} -g ${squid_gid}"
+ echo "pw useradd -n ${squid_user} -u ${squid_uid} \\"
+ echo " -c \"squid caching-proxy pseudo user\" \\"
+ echo " -g ${squid_group} -d ${squid_base} -s /sbin/nologin \\"
+ echo " -h -"
+ echo "find -H ${PKG_PREFIX} -user ${current_uid} -exec chown ${squid_user} {} \\;"
+ echo "find -H ${PKG_PREFIX} -group ${current_gid} -exec chgrp ${squid_group} {} \\;"
+ echo ""
+ echo "In case you have installed third party software for squid"
+ echo "like squidGuard, you should additionally run:"
+ echo "find -H /var -user ${current_uid} -exec chown ${squid_user} {} \\;"
+ echo "find -H /var -group ${current_gid} -exec chgrp ${squid_group} {} \\;"
+ echo ""
+ if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
+ sleep 30
+ fi
+ fi
for dir in cache logs; do
if [ ! -d ${squid_base}/${dir} ]; then
echo "Creating ${squid_base}/${dir}..."