[LUG.ro Mix] Bug#296875: apt-proxy: init script cosmetics and speedup
Horacio Castellini
lugro-mix@lugro.org.ar
Mon, 28 Feb 2005 18:49:25 -0300
Con esto ignauguro el sistema de alertas de Bugs... más peligrosos... según mi criterio...-------------------------------------------------------------------------------------
Package: apt-proxyVersion: 1.9.26Severity: minorTags: patch
Currently, the "/etc/init.d/apt-proxy stop" may do some output withoutclosing bracket: root:/etc/init.d# ./apt-proxy restart Stopping apt-proxy [wait 2. Starting apt-proxy.
Additionally, the script always sleeps for one second, which adds tothe shutdown delay.
Here is some additional patch to avoid this. If apt-proxy is fast (orthe machine slow?), no sleep is necessary. If waiting is necessary,output starts with "[wait 1" (and not "[wait 2") and correctly closesthe bracket. Additionally, in case the daemon wouldn't respond at all(never seen), output finishes with "aborted]."
===================================================================RCS file: /etc/init.d/RCS/apt-proxy,vretrieving revision 1.1.1.1diff -u -r1.1.1.1 /etc/init.d/apt-proxy--- /etc/init.d/apt-proxy 2005-02-23 00:59:27+01 1.1.1.1+++ /etc/init.d/apt-proxy 2005-02-25 12:18:23+01@@ -48,21 +48,26 @@ stop) echo -n "Stopping apt-proxy"+ start-stop-daemon --stop --quiet --pidfile $pidfile+ #+ # Continue stopping until daemon finished or time over+ # count=0 pid=$(cat $pidfile 2>/dev/null) while alive $pid; do- start-stop-daemon --stop --quiet --pidfile $pidfile- count=$(expr $count + 1) if [ $count -gt 20 ]; then+ echo -n " aborted" break;- elif [ $count = 2 ]; then+ elif [ $count = 1 ]; then echo -n " [wait $count"- elif [ $count -gt 2 ]; then+ elif [ $count -gt 1 ]; then echo -n " $count" fi+ count=$(expr $count + 1) sleep 1+ start-stop-daemon --stop --quiet --pidfile $pidfile done- if [ $count -gt 2 ]; then+ if [ $count -gt 1 ]; then echo -n "]" fi echo "." ===================================================================
-- System Information:Debian Release: 3.1 APT prefers testing APT policy: (990, 'testing'), (500, 'unstable')Architecture: i386 (i686)Kernel: Linux 2.6.7-1-k7Locale: LANG=de_DE@euro, LC_CTYPE=de_DE@euro (charmap=ISO-8859-15)
Versions of packages apt-proxy depends on:ii bzip2 1.0.2-1 A high-quality block-sorting file ii debconf 1.4.30.11 Debian configuration management syii logrotate 3.7-2 Log rotation utilityii python 2.3.4-5 An interactive high-level object-oii python-apt 0.5.10 Python interface to libapt-pkgii python-bsddb3 3.3.0-6 Python interface to libdb3ii python-twisted 1.3.0-8 Event-based framework for internetii python2.3 2.3.5-1 An interactive high-level object-o