freebsd-ports/www/squid33/files/pkg-install.in
Thomas-Martin Seck 86a309115d - Update to 3.3.5 including vendor patches 12566 to 12572
- Remove some leftovers from the repocopy of squid32 [1]
- Move the creation/deletion of the Squid state directory from
  pkg-install/pkg-deinstall to rc.d/squid [2]
- Add a squid_getpid function and update the procname pattern to get
  the correct name and PID of Squid's master process

PR:		ports/178511 [1]
Submitted by:	crees [2]
Approved by:	crees (mentor)
2013-06-09 19:47:46 +00:00

70 lines
1.9 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
PATH=/bin:/usr/bin:/usr/sbin
pkgname=$1
squid_homedir="/var/squid"
squid_cache_basedir="${squid_homedir}/cache"
squid_confdir="${PKG_PREFIX:-%%PREFIX%%}/etc/squid"
squid_logdir="/var/log/squid"
# these are hardcoded, see /usr/ports/UIDs and /usr/ports/GIDs:
squid_user=squid
squid_group=squid
squid_gid=100
squid_uid=100
case $2 in
PRE-INSTALL)
echo "===> Pre-installation configuration for ${pkgname}"
;;
POST-INSTALL)
# Since we usually start the Squid master process as ${squid_user}
# instead of root make sure that ${squid_homedir} is writable for it.
if [ ! -d ${squid_homedir} ]; then
echo "Creating ${squid_homedir}..."
install -d -o root -g ${squid_group} \
-m 0775 ${squid_homedir}
else
chgrp ${squid_group} ${squid_homedir}
chmod g+w ${squid_homedir}
fi
if [ ! -d ${squid_cache_basedir} ]; then
echo "Creating ${squid_cache_basedir} ..."
install -d -o ${squid_user} -g ${squid_group} \
-m 0750 ${squid_cache_basedir}
else
chown ${squid_user} ${squid_cache_basedir}
chgrp ${squid_group} ${squid_cache_basedir}
chmod 0750 ${squid_cache_basedir}
fi
if [ ! -d ${squid_confdir} ]; then
echo "Creating ${squid_confdir}..."
install -d -o root -g ${squid_group} \
-m 0755 ${squid_confdir}
else
chgrp ${squid_group} ${squid_confdir}
fi
if [ ! -d ${squid_logdir} ]; then
echo "Creating ${squid_logdir}..."
install -d -o ${squid_user} -g ${squid_group} \
-m 0750 ${squid_logdir}
else
chown ${squid_user} ${squid_logdir}
chgrp ${squid_group} ${squid_logdir}
fi
for file in cachemgr.conf errorpage.css mime.conf msntauth.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