diff options
author | Sergei Kolobov <sergei@FreeBSD.org> | 2004-01-16 21:18:20 +0000 |
---|---|---|
committer | Sergei Kolobov <sergei@FreeBSD.org> | 2004-01-16 21:18:20 +0000 |
commit | 07a7de4337c11b7457da3c03b0586e8b300fffeb (patch) | |
tree | 8e40c8b62d7b5bf08fbf0f01cee14ea2809827f9 /www/squid31/files | |
parent | 51bb88223c9b028608721237c99936bb9280edf3 (diff) |
Notes
Diffstat (limited to 'www/squid31/files')
-rw-r--r-- | www/squid31/files/patch-src-cf.data.pre | 20 | ||||
-rw-r--r-- | www/squid31/files/squid.sh | 91 |
2 files changed, 90 insertions, 21 deletions
diff --git a/www/squid31/files/patch-src-cf.data.pre b/www/squid31/files/patch-src-cf.data.pre new file mode 100644 index 000000000000..2a8e1eff429f --- /dev/null +++ b/www/squid31/files/patch-src-cf.data.pre @@ -0,0 +1,20 @@ +--- src/cf.data.pre.orig Thu May 1 14:07:51 2003 ++++ src/cf.data.pre Thu May 1 14:13:12 2003 +@@ -2325,7 +2325,7 @@ + + NAME: cache_effective_user + TYPE: string +-DEFAULT: nobody ++DEFAULT: %%SQUID_UID%% + LOC: Config.effectiveUser + DOC_NONE + +@@ -2337,7 +2337,7 @@ + + If you start Squid as root, it will change its effective/real + UID/GID to the UID/GID specified below. The default is to +- change to UID to nobody. If you define cache_effective_user, ++ change to UID to %%SQUID_UID%%. If you define cache_effective_user, + but not cache_effective_group, Squid sets the GID the + effective user's default group ID (taken from the password + file). diff --git a/www/squid31/files/squid.sh b/www/squid31/files/squid.sh index 40f655b04f27..ec92a10bc3fc 100644 --- a/www/squid31/files/squid.sh +++ b/www/squid31/files/squid.sh @@ -1,26 +1,75 @@ #!/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. -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi +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 -case "$1" in -start) - if [ -x ${PREFIX}/sbin/squid -a -f ${PREFIX}/etc/squid/squid.conf ]; then - (cd /${PREFIX}/squid/logs; ${PREFIX}/sbin/squid >/dev/null 2>&1 &) ; echo -n ' squid' +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 - ;; -stop) - ${PREFIX}/sbin/squid -k shutdown 2>&1 - # Uncomment this if you'd like the system to (attempt to - # wait for) squid to shut down cleanly - #echo "Sleeping for 45 seconds to allow squid to shutdown.." - #sleep 45 - ;; -*) - echo "Usage: `basename $0` {start|stop}" >&2 - ;; -esac +fi -exit 0 +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 |