From: wessels <> Date: Fri, 11 Oct 1996 05:30:38 +0000 (+0000) Subject: SRV4 install fixes from Markus Gyger X-Git-Tag: SQUID_3_0_PRE1~5679 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e550e8b660ef27933f3eb206aef770db874f5a3a;p=thirdparty%2Fsquid.git SRV4 install fixes from Markus Gyger --- diff --git a/configure.in b/configure.in index 00fdfa4e44..b9f2e88135 100644 --- a/configure.in +++ b/configure.in @@ -3,13 +3,13 @@ dnl Configuration input file for Squid dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) dnl -dnl $Id: configure.in,v 1.36 1996/09/20 07:31:23 wessels Exp $ +dnl $Id: configure.in,v 1.37 1996/10/10 23:30:38 wessels Exp $ dnl dnl dnl AC_INIT(src/main.c) AC_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.36 $)dnl +AC_REVISION($Revision: 1.37 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AC_CONFIG_AUX_DIR(aux) @@ -488,4 +488,5 @@ AC_OUTPUT(\ ./scripts/RunAccel \ ./src/Makefile \ ./src/squid.conf.pre \ + ./contrib/Makefile \ ) diff --git a/contrib/Makefile.in b/contrib/Makefile.in new file mode 100644 index 0000000000..d40c608a2b --- /dev/null +++ b/contrib/Makefile.in @@ -0,0 +1,67 @@ +# +# Makefile for installing Squid startup files on systems +# using a SVR4-based startup mechanism/file system layout +# + +INSTALL = @INSTALL@ +INSTALL_BIN = @INSTALL_PROGRAM@ +INSTALL_FILE = @INSTALL_DATA@ +LN_S = @LN_S@ +RM = @RM@ + +SQUID_RC = squid.rc +SQUID_OPTIONS = squid.options + + +all: + +install: install-@host_os@ + +install-hpux10.10 install-hpux10.20: + $(INSTALL_BIN) $(SQUID_RC) /sbin/init.d/squid + $(INSTALL_FILE) $(SQUID_OPTIONS) /etc/rc.config.d/squid + -$(LN_S) ../init.d/squid /sbin/rc2.d/S900squid + -$(LN_S) ../init.d/squid /sbin/rc1.d/K100squid + /usr/sbin/ch_rc -ap SQUID=1 + @echo "use 'ch_rc -ap SQUID=0' to disable squid at startup" + @echo "edit /etc/rc.config.d/squid to change options" + +install-solaris2.4 install-solaris2.5: + $(INSTALL_BIN) $(SQUID_RC) /etc/init.d/squid + -$(LN_S) ../init.d/squid /etc/rc2.d/S90squid + -$(LN_S) ../init.d/squid /etc/rc1.d/K10squid + -$(LN_S) ../init.d/squid /etc/rc0.d/K10squid + @echo "set SQUID=0 in /etc/init.d/squid to disable squid at startup" + @echo "edit /etc/init.d/squid to change options" + +install-irix6.2: + $(INSTALL_BIN) $(SQUID_RC) /etc/init.d/squid + $(INSTALL_FILE) $(SQUID_OPTIONS) /var/config/squid.options + -$(LN_S) ../init.d/squid /etc/rc2.d/S99squid + -$(LN_S) ../init.d/squid /etc/rc0.d/K01squid + /sbin/chkconfig -f squid on + @echo "use 'chkconfig squid off' to disable squid at startup" + @echo "edit /var/config/squid.options to change options" + +install-osf3.2: + $(INSTALL_BIN) $(SQUID_RC) /sbin/init.d/squid + -$(LN_S) ../init.d/squid /sbin/rc2.d/S99squid + -$(LN_S) ../init.d/squid /sbin/rc0.d/K01squid + /usr/sbin/rcmgr set SQUID 1 + @echo "use 'rcmgr set SQUID 0' to disable squid at startup" + @echo "use 'rcmgr set SQUID_OPTIONS ...' to change options" + @echo "use 'rcmgr set SQUID_RESPAWN 0' to change option" + +install-linux: + $(INSTALL_BIN) $(SQUID_RC) /sbin/init.d/squid + -$(LN_S) ../squid /sbin/init.d/rc3.d/S90squid + -$(LN_S) ../squid /sbin/init.d/rc3.d/K10squid + grep '^SQUID=' /etc/rc.config || echo SQUID=1 >>/etc/rc.config + @echo "set SQUID=0 in /etc/rc.config to disable squid at startup" + @echo "edit /sbin/init.d/squid to change options" + +clean: + +realclean: clean + $(RM) Makefile + diff --git a/contrib/squid.options b/contrib/squid.options index 0449490df6..2a406f1098 100644 --- a/contrib/squid.options +++ b/contrib/squid.options @@ -2,14 +2,12 @@ # # Squid Internet Object Cache configuration # AUTHOR: Markus Gyger -# -# HP-UX 10: this is file /etc/rc.config.d/squid -# SGI IRIX: this is file /var/config/squid.options +# This is file /etc/rc.config.d/squid or /var/config/squid.options # SQUID: Set to 1 to enable Squid (HP-UX 10 only) -# SQUID_OPTIONS: Options passed to Squid (e.g. "-f squid.conf") +# SQUID_OPTIONS: Options passed to Squid (e.g. "-f .../squid.conf") # SQUID_RESPAWN: Set to 1 to automatically restart squid after failure -#SQUID=1 +SQUID=0 SQUID_OPTIONS="-s" SQUID_RESPAWN=1 diff --git a/contrib/squid.rc b/contrib/squid.rc new file mode 100644 index 0000000000..ce41f2300a --- /dev/null +++ b/contrib/squid.rc @@ -0,0 +1,119 @@ +#!/sbin/sh + +# Squid Internet Object Cache startup +# AUTHOR: Markus Gyger +# This is squid's startup file /sbin/init.d/squid or /etc/init.d/squid + + +PATH=/opt/squid/bin:/usr/sbin:/usr/bin:/sbin:/bin +export PATH + + +config() +{ + # SGI IRIX 6.2 + if [ -f /sbin/chkconfig ] + then if /sbin/chkconfig squid + then if [ -f /var/config/squid.options ] + then . /var/config/squid.options + fi + SQUID=1 + else SQUID=0 + fi + + # Digital UNIX + elif [ -f /usr/sbin/rcmgr ] + then SQUID=`/usr/sbin/rcmgr get SQUID 0` + SQUID_OPTIONS=`/usr/sbin/rcmgr get SQUID_OPTIONS "-s"` + SQUID_RESPAWN=`/usr/sbin/rcmgr get SQUID_RESPAWN 1` + + # HP-UX 10 / Linux + elif [ -f /etc/rc.config ] + then . /etc/rc.config + + # SUN Solaris 2 + else SQUID=1 + SQUID_OPTIONS="-s" + SQUID_RESPAWN=1 + fi + + [ 1 = "${SQUID-}" ] +} + + +respawn() +{ + trap "" 1 + fails=0 + while [ $fails -le 5 ] + do start=`date +%d%H%M%S` + if "$@" + then logger -t "$1" -p local4.notice \ + "respawn[$$]: Exiting due to shutdown" + return 0 + fi + stop=`date +%d%H%M%S` + time=`expr $stop - $start` + [ "$time" -gt 10 ] && fails=0 + fails=`expr $fails + 1` + done + + logger -t "$1" -p local4.alert \ + "respawn[$$]: Exiting due to repeated, frequent failures" + return 1 +} + + +case $* in +start_msg) + echo "Start Squid Internet Object Cache" + ;; + +stop_msg) + echo "Stopping Squid Internet Object Cache" + ;; + +start) + config || exit 2 # Squid not enabled + + if whence=`type squid 2>&1` + then trap "" 1 + if [ 0 = "${SQUID_RESPAWN-}" ] + then squid ${SQUID_OPTIONS-} & + else respawn squid ${SQUID_OPTIONS-} & + fi + + else echo "ERROR: $whence" >&2 + exit 1 + fi + ;; + +stop) + config || exit 2 # Squid not enabled + + squid ${SQUID_OPTIONS-} -k shutdown || exit 1 + ;; + +reconf*|rotate|int*|debug|check|kill) + config + + squid ${SQUID_OPTIONS-} -k "$1" + ;; + +*) + echo "usage: $0 {start|stop|reconfigure|rotate|interrupt|debug|check|kill}" >&2 + echo " start start squid" >&2 + echo " stop clean shutdown" >&2 + echo " reconfigure reread configuration files" >&2 + echo " rotate rotate log files" >&2 + echo " interrupt quick clean shutdown " >&2 + echo " debug toggle debug logging" >&2 + echo " check check for running squid" >&2 + echo " kill terminate squid by brute force" >&2 + + exit 1 + ;; +esac + +[ $? -eq 0 ] # only 0 and 1 exit values allowed +exit