freebsd-ports/www/squid27/files/squid.sh
Sergei Kolobov 07a7de4337 - configure squid to run under a dedicated "squid" user by default; make use
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
2004-01-16 21:18:20 +00:00

75 lines
1.8 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: squid
# REQUIRE: NETWORKING SERVERS
# BEFORE: DAEMON
# KEYWORD: FreeBSD
#
# Note:
# If you are running an rcNG-System (i.e. FreeBSD 5 and later or after
# having installed the rc_subr-port on an earlier system) you must set
# "squid_enable=YES" in either /etc/rc.conf, /etc/rc.conf.local or
# /etc/rc.conf.d/squid to make this script actually do something. There
# you can also set squid_chdir, squid_user, and squid_flags.
#
# Please see squid(8), rc.conf(5) and rc(8) for further details.
unset rcNG
name="squid"
command=%%PREFIX%%/sbin/squid
extra_commands=reload
reload_cmd="${command} -k reconfigure"
stop_cmd="${command} -k shutdown"
: ${squid_chdir:=%%PREFIX%%/squid/logs}
: ${squid_user:=%%SQUID_UID%%}
: ${squid_flags:="-D"}
default_config=%%PREFIX%%/etc/squid/squid.conf
if [ -f /etc/rc.subr ]; then
. /etc/rc.subr && rcNG=yes
else
if [ -f %%PREFIX%%/etc/rc.subr ]; then
. %%PREFIX%%/etc/rc.subr && rcNG=yes
fi
fi
if [ "${rcNG}" ]; then
rcvar=`set_rcvar`
load_rc_config ${name}
# check that squid's default configuration is present when
# squid_flags is not set. We assume that you specify at
# least the path to your non-default configuration with
# '-f /path/to/config.file' in squid_flags if you delete this file.
if [ -z "${squid_flags}" ]; then
required_files=${default_config}
fi
required_dirs=${squid_chdir}
run_rc_command "$1"
else
case $1 in
start)
if [ -x "${command}" -a \
\( -f "${default_config}" -o "${squid_flags}" \) ]; then
echo -n ' squid'
(cd ${squid_chdir} && exec su -fm ${squid_user} -c \
"${command} ${squid_flags}")
fi
;;
stop)
if [ -x "${command}" ]; then
echo -n ' squid'
${stop_cmd}
while ps -xcU ${squid_user} | grep -q squid; do
sleep 2
done
fi
;;
*)
echo "usage: `basename $0` {start|stop}" >&2
exit 64
;;
esac
exit 0
fi