07a7de4337
of SQUID_{UID,GID} which other squid-related ports already implemented. The user/group will be created on the fly if they do not already exist. - introduce WITH_SQUID_LDAP_AUTH to pull in the necessary bits to compile and use the ldap_auth helper - install some more authentication helper applications by default - install helper applications to ${PREFIX}/libexec/squid instead of ${PREFIX}/libexec, add notes about it in pkg-install and pkg-descr - cleanup the pre-installation tasks and move them from Makefile and pkg-plist into the pkg-install script; make 'make install' and 'pkg_add' actually do the same thing - introduce a pkg-deinstall script - make squid.sh rcNG compatible (when either /etc/rc_subr or ${PREFIX}/etc/rc_subr is present, the first one will be used, otherwise the script will work as a "rc classic" script so no additional dependency on the rc_subr port should be needed) - some Makefile cleanups: + the squid installation procedure now correctly strips binaries, so there is no need to do this manually anymore + generate those parts of pkg-plist dynamically that may be affected by user set tunables (currently the localized error pages and helper applications) + document the available configuration options in a slightly different style + remove some obsolete variable declarations and comments + honor NOPORTDOCS - add CONFLICTS - add another vendor patch, see http://www.squid-cache.org/bugs/show_bug.cgi?id=890 for a thorough explanation of what has been fixed. - since we can no longer take the presence of Lithuanian error pages for granted, wrap the workaround for the errorpages.patch with '.if exists()' - bump PORTREVISION PR: 61315 Submitted by: maintainer
105 lines
3.3 KiB
Bash
105 lines
3.3 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
PATH=/bin:/usr/bin:/usr/sbin
|
|
pkgname=$1
|
|
squid_base=${PKG_PREFIX:-/usr/local}/squid
|
|
squid_confdir=${PKG_PREFIX:-/usr/local}/etc/squid
|
|
squid_user=${SQUID_UID:=squid}
|
|
squid_group=${SQUID_GID:=squid}
|
|
squid_gid=3128
|
|
squid_uid=3128
|
|
|
|
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
|
|
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
|
|
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} \
|
|
-d "${squid_base}" -s "/sbin/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 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
|
|
|
|
echo "===> Post-installation informations for ${pkgname}"
|
|
echo ""
|
|
echo " o You can find the configuration files for this package"
|
|
echo " in the directory ${squid_confdir}."
|
|
echo ""
|
|
echo " o A cache directory has been created in ${squid_base}/cache."
|
|
echo " Log files will be written to ${squid_base}/logs."
|
|
echo ""
|
|
echo " o The default configuration will deny everyone access to the"
|
|
echo " proxy service. Edit the \"http_access\" directives in"
|
|
echo " ${squid_confdir}/squid.conf to suit your needs."
|
|
echo ""
|
|
echo " o If you never ran squid on this system before, you need to"
|
|
echo " initialize the cache directory by running \"squid -z\""
|
|
echo " as 'root' or '${squid_user}' before starting squid."
|
|
echo ""
|
|
tput md
|
|
echo " *** UPDATE NOTICE ***"
|
|
echo ""
|
|
echo " Starting with version 2.5.4_6, all helper applications are"
|
|
echo " installed to ${PKG_PREFIX}/libexec/squid instead of"
|
|
echo " ${PKG_PREFIX}/libexec."
|
|
echo " Please check your squid.conf and update it if necessary."
|
|
tput me
|
|
echo ""
|
|
;;
|
|
*)
|
|
exit 64
|
|
;;
|
|
esac
|
|
exit 0
|