Tue Mar 11 15:46:41 2008 UTC ()
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.


(taca)
diff -r1.202 -r1.203 pkgsrc/www/squid/Makefile
diff -r1.20 -r1.21 pkgsrc/www/squid/files/squid.sh

cvs diff -r1.202 -r1.203 pkgsrc/www/squid/Attic/Makefile (expand / switch to unified diff)

--- pkgsrc/www/squid/Attic/Makefile 2008/01/18 05:09:53 1.202
+++ pkgsrc/www/squid/Attic/Makefile 2008/03/11 15:46:41 1.203
@@ -1,18 +1,18 @@ @@ -1,18 +1,18 @@
1# $NetBSD: Makefile,v 1.202 2008/01/18 05:09:53 tnn Exp $ 1# $NetBSD: Makefile,v 1.203 2008/03/11 15:46:41 taca Exp $
2 2
3DISTNAME= squid-2.6.STABLE18 3DISTNAME= squid-2.6.STABLE18
4PKGNAME= ${DISTNAME:S/STABLE//} 4PKGNAME= ${DISTNAME:S/STABLE//}
5PKGREVISION= 1 5PKGREVISION= 2
6CATEGORIES= www 6CATEGORIES= www
7MASTER_SITES= http://www.squid-cache.org/Versions/v2/2.6/ 7MASTER_SITES= http://www.squid-cache.org/Versions/v2/2.6/
8EXTRACT_SUFX= .tar.bz2 8EXTRACT_SUFX= .tar.bz2
9 9
10MAINTAINER= taca@NetBSD.org 10MAINTAINER= taca@NetBSD.org
11HOMEPAGE= http://www.squid-cache.org/ 11HOMEPAGE= http://www.squid-cache.org/
12COMMENT= Post-Harvest_cached WWW proxy cache and accelerator 12COMMENT= Post-Harvest_cached WWW proxy cache and accelerator
13 13
14WRKSRC= ${WRKDIR}/${DISTNAME:S/-src//} 14WRKSRC= ${WRKDIR}/${DISTNAME:S/-src//}
15 15
16DOCDIR= ${PREFIX}/share/doc/squid 16DOCDIR= ${PREFIX}/share/doc/squid
17EXAMPLESDIR= ${PREFIX}/share/examples/squid 17EXAMPLESDIR= ${PREFIX}/share/examples/squid
18 18

cvs diff -r1.20 -r1.21 pkgsrc/www/squid/files/Attic/squid.sh (expand / switch to unified diff)

--- pkgsrc/www/squid/files/Attic/squid.sh 2008/01/31 20:01:13 1.20
+++ pkgsrc/www/squid/files/Attic/squid.sh 2008/03/11 15:46:41 1.21
@@ -1,36 +1,41 @@ @@ -1,36 +1,41 @@
1#!@RCD_SCRIPTS_SHELL@ 1#!@RCD_SCRIPTS_SHELL@
2# 2#
3# $NetBSD: squid.sh,v 1.20 2008/01/31 20:01:13 adam Exp $ 3# $NetBSD: squid.sh,v 1.21 2008/03/11 15:46:41 taca Exp $
4# 4#
5 5
6# PROVIDE: squid 6# PROVIDE: squid
7# REQUIRE: DAEMON 7# REQUIRE: DAEMON
8# KEYWORD: shutdown 8# KEYWORD: shutdown
9 9
10conf_file="@PKG_SYSCONFDIR@/squid.conf" 10if [ -f /etc/rc.subr ]; then
 11 . /etc/rc.subr
 12fi
 13
 14: ${squid_conf:=@PKG_SYSCONFDIR@/squid.conf}
11 15
12name="squid" 16name="squid"
13rcvar=$name 17rcvar=$name
14command="@PREFIX@/sbin/${name}" 18command="@PREFIX@/sbin/${name}"
15pidfile="@VARBASE@/run/${name}.pid" 19pidfile="@VARBASE@/run/${name}.pid"
16required_files="${conf_file} @PKG_SYSCONFDIR@/mime.conf" 20required_files="${squid_conf} @PKG_SYSCONFDIR@/mime.conf"
17command_args="-Y -f $conf_file" 21command_args="-Y -f ${squid_conf}"
18 22
19stop_cmd="stop_nicely" 23stop_cmd="stop_nicely"
20kill_command="${command} -k shutdown" 24kill_command="${command} ${squid_flags} ${command_args} -k shutdown"
21reload_cmd="${command} -k reconfigure" 25reload_cmd="${command} ${squid_flags} ${command_args} -k reconfigure"
22rotate_cmd="${command} -k rotate" 26rotate_cmd="${command} ${squid_flags} ${command_args} -k rotate"
23createdirs_cmd="squid_createdirs" 27createdirs_cmd="${command} ${squid_flags} ${command_args} -z"
 28extra_commands="createdirs reload rotate"
24 29
25#### end of configuration section #### 30#### end of configuration section ####
26 31
27# XXX Shouldn't the default stop_cmd be this patient too? 32# XXX Shouldn't the default stop_cmd be this patient too?
28# 33#
29stop_nicely () 34stop_nicely ()
30{ 35{
31 if [ -f ${pidfile} ] ; then 36 if [ -f ${pidfile} ] ; then
32 DAEMON_PID=`sed 1q ${pidfile}` 37 DAEMON_PID=`sed 1q ${pidfile}`
33 @ECHO@ -n "Stopping ${name}" 38 @ECHO@ -n "Stopping ${name}"
34 ${kill_command} 39 ${kill_command}
35 if [ ${DAEMON_PID} -ne 0 ]; then 40 if [ ${DAEMON_PID} -ne 0 ]; then
36 @ECHO@ -n '[' 41 @ECHO@ -n '['
@@ -41,58 +46,49 @@ stop_nicely () @@ -41,58 +46,49 @@ stop_nicely ()
41 @ECHO@ -n '.' 46 @ECHO@ -n '.'
42 test $WAIT -lt 15 || kill ${DAEMON_PID} 47 test $WAIT -lt 15 || kill ${DAEMON_PID}
43 else 48 else
44 break 49 break
45 fi 50 fi
46 done 51 done
47 @ECHO@ '].' 52 @ECHO@ '].'
48 unset WAIT 53 unset WAIT
49 fi 54 fi
50 unset DAEMON_PID 55 unset DAEMON_PID
51 fi 56 fi
52} 57}
53 58
54# create the squid cache directories 59if [ -f /etc/rc.subr -a -f /etc/rc.conf -a -f /etc/rc.d/DAEMON ]; then
55squid_createdirs() 
56{ 
57 ${command} -z 
58} 
59 
60if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then 
61 . /etc/rc.subr 
62 . /etc/rc.conf 
63 
64 extra_commands="createdirs reload rotate" 
65 load_rc_config $name 60 load_rc_config $name
66 run_rc_command "$1" 61 run_rc_command "$1"
67 
68else # old NetBSD, Solaris, Linux, etc... 62else # old NetBSD, Solaris, Linux, etc...
69 63 if [ -f /etc/rc.conf ]; then
 64 . /etc/rc.conf
 65 fi
70 case $1 in 66 case $1 in
71 start) 67 start)
72 if [ -x ${command} -a -f ${conf_file} ] ; then 68 start_cmd="${command} ${squid_flags} ${command_args}"
 69 if [ -x ${command} -a -f ${squid_conf} ] ; then
73 eval ${start_cmd} && @ECHO@ -n " ${name}" 70 eval ${start_cmd} && @ECHO@ -n " ${name}"
74 fi 71 fi
75 ;; 72 ;;
76 stop) 73 stop)
77 ${stop_cmd} 74 ${stop_cmd}
78 ;; 75 ;;
79 createdirs) 76 createdirs)
80 squid_createdirs 77 ${createdirs_cmd}
81 ;; 78 ;;
82 reload) 79 reload)
83 if [ -f ${pidfile} ] ; then 80 if [ -f ${pidfile} ] ; then
84 ${reload_cmd} 81 ${reload_cmd}
85 fi 82 fi
86 ;; 83 ;;
87 rotate) 84 rotate)
88 if [ -f ${pidfile} ] ; then 85 if [ -f ${pidfile} ] ; then
89 ${rotate_cmd} 86 ${rotate_cmd}
90 fi 87 fi
91 ;; 88 ;;
92 *) 89 *)
93 @ECHO@ "Usage: $0 {start|stop|reload|createdirs}" 1>&2 90 @ECHO@ "Usage: $0 {start|stop|reload|createdirs}" 1>&2
94 exit 64 91 exit 64
95 ;; 92 ;;
96 esac 93 esac
97 
98fi 94fi