r20316 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r20315‎ | r20316 | r20317 >
Date:20:07, 10 March 2007
Author:tstarling
Status:old
Tags:
Comment:
Added squid-frontend package
Modified paths:
  • /trunk/debs/squid/debian/changelog (modified) (history)
  • /trunk/debs/squid/debian/control (modified) (history)
  • /trunk/debs/squid/debian/postinst.squid-frontend (added) (history)
  • /trunk/debs/squid/debian/postrm.squid-frontend (added) (history)
  • /trunk/debs/squid/debian/rules (modified) (history)
  • /trunk/debs/squid/debian/squid-frontend.links (added) (history)
  • /trunk/debs/squid/debian/squid-frontend.rc (added) (history)

Diff [purge]

Index: trunk/debs/squid/debian/control
@@ -54,3 +54,11 @@
5555 Description: Squid cache manager CGI program
5656 This CGI program can be used to query and administrate a `squid' proxy
5757 cache through your web browser.
 58+
 59+Package: squid-frontend
 60+Architecture: any
 61+Section: web
 62+Priority: optional
 63+Depends: squid
 64+Description: Second squid instance for CARP load balancing.
 65+
Index: trunk/debs/squid/debian/squid-frontend.links
@@ -0,0 +1 @@
 2+usr/sbin/squid usr/sbin/squid-frontend
Index: trunk/debs/squid/debian/postinst.squid-frontend
@@ -0,0 +1,10 @@
 2+#! /bin/sh
 3+
 4+update-rc.d squid-frontend defaults 30 >/dev/null
 5+if [ -f /etc/squid/frontend.conf ]
 6+then
 7+ invoke-rc.d squid-frontend restart
 8+else
 9+ exit 0
 10+fi
 11+
Index: trunk/debs/squid/debian/postrm.squid-frontend
@@ -0,0 +1,36 @@
 2+#! /bin/sh
 3+
 4+case "$1" in
 5+ remove)
 6+ ;;
 7+ purge)
 8+ if [ -e /usr/share/debconf/confmodule ]; then
 9+ # Source debconf library.
 10+ . /usr/share/debconf/confmodule
 11+ # Remove my changes to the db.
 12+ db_purge
 13+ fi
 14+ echo "Purging startup links .."
 15+ rm -f /etc/init.d/squid-frontend
 16+ update-rc.d squid-frontend remove > /dev/null
 17+ echo "Purging logfiles .."
 18+ rm -rf /var/log/squid-frontend
 19+ if [ -f /etc/squid/frontend.conf ]; then
 20+ echo "Removing the config-file .."
 21+ rm -f /etc/squid/frontend.conf
 22+ fi
 23+ if [ -f /etc/default/squid-frontend ]; then
 24+ rm -f /etc/default/squid-frontend
 25+ fi
 26+
 27+ #
 28+ # We do not remove /var/spool/squid because that might
 29+ # take a lot of time. Most of the time it is on a seperate
 30+ # disk anyway and it is faster to do a mkfs on it..
 31+ #
 32+ echo "Remove the proxy cache in /var/spool/squid-frontend yourself!"
 33+ ;;
 34+ failed-upgrade|upgrade|abort-install|abort-upgrade|disappear)
 35+ ;;
 36+esac
 37+
Index: trunk/debs/squid/debian/changelog
@@ -1,3 +1,15 @@
 2+squid (2.6.9-1wm5) edgy; urgency=low
 3+
 4+ * Added squid-frontend package
 5+
 6+ -- Tim Starling <tstarling@wikimedia.org> Wed, 7 Mar 2007 23:16:30 +0000
 7+
 8+squid (2.6.9-1wm4) edgy; urgency=low
 9+
 10+ * Bug fix in variant invalidation
 11+
 12+ -- Tim Starling <tstarling@wikimedia.org> Mon, 26 Feb 2007 17:24:34 +0000
 13+
214 squid (2.6.9-1wm3) edgy; urgency=low
315
416 * Variant invalidation patch
Index: trunk/debs/squid/debian/rules
@@ -221,7 +221,26 @@
222222 dpkg --build $(tmp) ..
223223 rm -f debian/substvars
224224 rm -rf $(tmp)
 225+ #
 226+ # Build squid-frontend package
 227+ #
 228+ $(INSTALL_DIR) $(tmp)/DEBIAN
 229+ $(INSTALL_DIR) $(tmp)/etc/init.d
 230+ $(INSTALL_DIR) $(tmp)/usr/sbin
 231+ $(INSTALL_DIR) $(tmp)/var/spool
 232+ install -m 750 -o proxy -g proxy -d $(tmp)/var/spool/squid-frontend
 233+ $(INSTALL_DIR) $(tmp)/var/log
 234+ install -m 750 -o proxy -g proxy -d $(tmp)/var/log/squid-frontend
 235+ dh_link -p squid-frontend -P $(tmp)
 236+ $(INSTALL_SCRIPT) debian/squid-frontend.rc $(tmp)/etc/init.d/squid-frontend
 237+ $(INSTALL_SCRIPT) debian/postinst.squid-frontend $(tmp)/DEBIAN/postinst
 238+ $(INSTALL_SCRIPT) debian/postrm.squid-frontend $(tmp)/DEBIAN/postrm
 239+ dpkg-gencontrol -isp -psquid-frontend
 240+ dpkg --build $(tmp) ..
 241+ rm -f debian/substvars
 242+ rm -rf $(tmp)
225243
 244+
226245 # Make a binary package (.deb file)
227246 binary-arch: build checkroot
228247 #
Index: trunk/debs/squid/debian/squid-frontend.rc
@@ -0,0 +1,128 @@
 2+#! /bin/sh
 3+#
 4+# squid Startup script for the SQUID HTTP proxy-cache.
 5+#
 6+# Version: @(#)squid.rc 2.20 01-Oct-2001 miquels@cistron.nl
 7+#
 8+
 9+NAME=squid-frontend
 10+DAEMON=/usr/sbin/squid-frontend
 11+LIB=/usr/lib/squid
 12+PIDFILE=/var/run/$NAME.pid
 13+SQUID_ARGS="-D -sYC -f /etc/squid/frontend.conf"
 14+
 15+[ ! -f /etc/default/squid-frontend ] || . /etc/default/squid-frontend
 16+
 17+. /lib/lsb/init-functions
 18+
 19+PATH=/bin:/usr/bin:/sbin:/usr/sbin
 20+
 21+[ -x $DAEMON ] || exit 0
 22+
 23+
 24+#
 25+# Try to increase the # of filedescriptors we can open.
 26+#
 27+maxfds () {
 28+ [ -n "$SQUID_MAXFD" ] || return
 29+ [ -f /proc/sys/fs/file-max ] || return 0
 30+ [ $SQUID_MAXFD -le 65536 ] || SQUID_MAXFD=65536
 31+ global_file_max=`cat /proc/sys/fs/file-max`
 32+ minimal_file_max=$(($SQUID_MAXFD + 4096))
 33+ if [ "$global_file_max" -lt $minimal_file_max ]
 34+ then
 35+ echo $minimal_file_max > /proc/sys/fs/file-max
 36+ fi
 37+ ulimit -n $SQUID_MAXFD
 38+}
 39+
 40+start () {
 41+ if [ "$CHUID" = "" ]; then
 42+ CHUID=root
 43+ fi
 44+
 45+ maxfds
 46+ umask 027
 47+ ulimit -c unlimited # Do create core files, so we can fix bugs
 48+ cd /var/spool/$NAME
 49+ start-stop-daemon --quiet --start \
 50+ --pidfile $PIDFILE \
 51+ --chuid $CHUID \
 52+ --exec $DAEMON -- $SQUID_ARGS < /dev/null
 53+ return $?
 54+}
 55+
 56+stop () {
 57+ PID=`cat $PIDFILE 2>/dev/null`
 58+ start-stop-daemon --stop --quiet --pidfile $PIDFILE --name $NAME
 59+ #
 60+ # Now we have to wait until squid has _really_ stopped.
 61+ #
 62+ sleep 2
 63+ if test -n "$PID" && kill -0 $PID 2>/dev/null
 64+ then
 65+ log_action_begin_msg " Waiting"
 66+ cnt=0
 67+ while kill -0 $PID 2>/dev/null
 68+ do
 69+ cnt=`expr $cnt + 1`
 70+ if [ $cnt -gt 24 ]
 71+ then
 72+ log_action_end_msg 1
 73+ return 1
 74+ fi
 75+ sleep 5
 76+ log_action_cont_msg ""
 77+ done
 78+ log_action_end_msg 0
 79+ return 0
 80+ else
 81+ return 0
 82+ fi
 83+}
 84+
 85+case "$1" in
 86+ start)
 87+ log_daemon_msg "Starting Squid HTTP proxy" "$NAME"
 88+ if start ; then
 89+ log_end_msg $?
 90+ else
 91+ log_end_msg $?
 92+ fi
 93+ ;;
 94+ stop)
 95+ log_daemon_msg "Stopping Squid HTTP proxy" "$NAME"
 96+ if stop ; then
 97+ log_end_msg $?
 98+ else
 99+ log_end_msg $?
 100+ fi
 101+ ;;
 102+ reload|force-reload)
 103+ log_action_msg "Reloading Squid configuration files"
 104+ start-stop-daemon --stop --signal 1 \
 105+ --pidfile $PIDFILE --quiet --exec $DAEMON
 106+ log_action_end_msg 0
 107+ ;;
 108+ restart)
 109+ log_daemon_msg "Restarting Squid HTTP proxy" "$NAME"
 110+ RESTART=yes
 111+ stop
 112+ if start ; then
 113+ log_end_msg $?
 114+ else
 115+ log_end_msg $?
 116+ fi
 117+ ;;
 118+ clean)
 119+ echo "/etc/init.d/$NAME clean is not supported for the CARP instance"
 120+ exit 3
 121+ ;;
 122+ *)
 123+ echo "Usage: /etc/init.d/$NAME {start|stop|reload|force-reload|restart}"
 124+ exit 3
 125+ ;;
 126+esac
 127+
 128+exit 0
 129+