pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/squid Improve startup script:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3992cb274dec
branches:  trunk
changeset: 539685:3992cb274dec
user:      taca <taca%pkgsrc.org@localhost>
date:      Tue Mar 11 15:46:41 2008 +0000

description:
Improve startup script:

- Revive support for system without NetBSD style rc/rc.d.
- Always pass command_args and squid_flags to squid command.

This should fix the PR pkg/38036 by Wolfgang Stukenbrock.

Bump PKGREVISION.

diffstat:

 www/squid/Makefile       |   4 ++--
 www/squid/files/squid.sh |  44 ++++++++++++++++++++------------------------
 2 files changed, 22 insertions(+), 26 deletions(-)

diffs (104 lines):

diff -r 23fc0a3278a9 -r 3992cb274dec www/squid/Makefile
--- a/www/squid/Makefile        Tue Mar 11 15:39:16 2008 +0000
+++ b/www/squid/Makefile        Tue Mar 11 15:46:41 2008 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.202 2008/01/18 05:09:53 tnn Exp $
+# $NetBSD: Makefile,v 1.203 2008/03/11 15:46:41 taca Exp $
 
 DISTNAME=      squid-2.6.STABLE18
 PKGNAME=       ${DISTNAME:S/STABLE//}
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    www
 MASTER_SITES=  http://www.squid-cache.org/Versions/v2/2.6/
 EXTRACT_SUFX=  .tar.bz2
diff -r 23fc0a3278a9 -r 3992cb274dec www/squid/files/squid.sh
--- a/www/squid/files/squid.sh  Tue Mar 11 15:39:16 2008 +0000
+++ b/www/squid/files/squid.sh  Tue Mar 11 15:46:41 2008 +0000
@@ -1,26 +1,31 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: squid.sh,v 1.20 2008/01/31 20:01:13 adam Exp $
+# $NetBSD: squid.sh,v 1.21 2008/03/11 15:46:41 taca Exp $
 #
 
 # PROVIDE: squid
 # REQUIRE: DAEMON
 # KEYWORD: shutdown
 
-conf_file="@PKG_SYSCONFDIR@/squid.conf"
+if [ -f /etc/rc.subr ]; then
+       . /etc/rc.subr
+fi
+
+: ${squid_conf:=@PKG_SYSCONFDIR@/squid.conf}
 
 name="squid"
 rcvar=$name
 command="@PREFIX@/sbin/${name}"
 pidfile="@VARBASE@/run/${name}.pid"
-required_files="${conf_file} @PKG_SYSCONFDIR@/mime.conf"
-command_args="-Y -f $conf_file"
+required_files="${squid_conf} @PKG_SYSCONFDIR@/mime.conf"
+command_args="-Y -f ${squid_conf}"
 
 stop_cmd="stop_nicely"
-kill_command="${command} -k shutdown"
-reload_cmd="${command} -k reconfigure"
-rotate_cmd="${command} -k rotate"
-createdirs_cmd="squid_createdirs"
+kill_command="${command} ${squid_flags} ${command_args} -k shutdown"
+reload_cmd="${command} ${squid_flags} ${command_args} -k reconfigure"
+rotate_cmd="${command} ${squid_flags} ${command_args} -k rotate"
+createdirs_cmd="${command} ${squid_flags} ${command_args} -z"
+extra_commands="createdirs reload rotate"
 
 #### end of configuration section ####
 
@@ -51,25 +56,17 @@
        fi
 }
 
-# create the squid cache directories
-squid_createdirs()
-{
-       ${command} -z
-}
-
-if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
-       . /etc/rc.subr
-       . /etc/rc.conf
-
-       extra_commands="createdirs reload rotate"
+if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -f /etc/rc.d/DAEMON ]; then
        load_rc_config $name
        run_rc_command "$1"
-
 else                           # old NetBSD, Solaris, Linux, etc...
-
+       if [ -f /etc/rc.conf ]; then
+               . /etc/rc.conf
+       fi
        case $1 in
        start)
-               if [ -x ${command} -a -f ${conf_file} ] ; then
+               start_cmd="${command} ${squid_flags} ${command_args}"
+               if [ -x ${command} -a -f ${squid_conf} ] ; then
                        eval ${start_cmd} && @ECHO@ -n " ${name}"
                fi
                ;;
@@ -77,7 +74,7 @@
                ${stop_cmd}
                ;;
        createdirs)
-               squid_createdirs
+               ${createdirs_cmd}
                ;;
        reload)
                if [ -f ${pidfile} ] ; then
@@ -94,5 +91,4 @@
                exit 64
                ;;
        esac
-
 fi



Home | Main Index | Thread Index | Old Index