tags 309495 patch
thanks

Well, here is a patch for the immediate issue.  I was unable to duplicate
the problem of the original reporter exactly; it looked to me like the
proxy configuration was always removed on purge.  However, it wasn't
removed on reconfigure or on reinstall.  This patch corrects that, as well
as getting the port number correct in /etc/environment.

However, the package still doesn't work as-is since the IP address that's
hard-coded into the init script, while running some service on port 3000,
doesn't appear to respond to this particular service in a way that this
program understands.

I'm also very leery of this sort of configuration... even apart from the
question of a Debian package that sends data to a given IP address not
under Debian control (that doesn't even have reverse DNS), is there really
a guarantee that that address will remain stable over the life of sarge?

It seems like there should be a debconf prompt for the next IP address in
the mix chain or something....

Anyway, that's probably a different bug.  Here's the patch for this bug.

diff -ru anon-proxy-00.02.39/debian/postinst 
anon-proxy-00.02.39.patched/debian/postinst
--- anon-proxy-00.02.39/debian/postinst 2005-05-20 14:53:25.000000000 -0700
+++ anon-proxy-00.02.39.patched/debian/postinst 2005-05-20 14:50:10.000000000 
-0700
@@ -10,6 +10,9 @@
 
 EE="/etc/environment"
 
+# This must agree with the init script.
+PORT=4001
+
 # summary of how this script can be called:
 #        * <postinst> `configure' <most-recently-configured-version>
 #        * <old-postinst> `abort-upgrade' <new version>
@@ -57,6 +60,17 @@
         echo "http_proxy=http://localhost:$PORT # +ANON_MARK+" >> $EE.tmp
         cat -s $EE.tmp > $EE
     fi
+
+    # Handle the dpkg-reconfigure case of deciding to no longer let anon-proxy
+    # handle the environment settings.
+    if [ -z "$ENV" ] || [ "$ENV" = "false" ]; then
+        if grep -q "+ANON_MARK+" $EE; then
+            grep -v "+ANON_MARK+" $EE | grep -vi "^http_proxy" > $EE.tmp
+            cp -f $EE.tmp $EE
+        fi
+    fi
+
+    # Regardless, remove the temporary file.
     rm -f $EE.tmp
 
     if dpkg --compare-versions "$2" lt "0.02.39-4"; then
diff -ru anon-proxy-00.02.39/debian/prerm 
anon-proxy-00.02.39.patched/debian/prerm
--- anon-proxy-00.02.39/debian/prerm    2005-05-20 14:53:25.000000000 -0700
+++ anon-proxy-00.02.39.patched/debian/prerm    2005-05-20 14:50:21.000000000 
-0700
@@ -21,18 +21,19 @@
 . /usr/share/debconf/confmodule
 
 case "$1" in
-    remove)
+    remove|deconfigure)
         db_get anon-proxy/environment && ENV=$RET
         db_stop
         if [ -n "$ENV" ] && [ "$ENV" != "false" ]; then
             if [ -e $EE ]; then
                 grep -v "+ANON_MARK+" $EE | grep -vi "^http_proxy" > $EE.tmp
                 cp -f $EE.tmp $EE
+                rm -f $EE.tmp
             fi
         fi
         /etc/init.d/anon-proxy stop
         ;;
-    upgrade|deconfigure)
+    upgrade)
         /etc/init.d/anon-proxy stop
         ;;
     failed-upgrade)

-- 
Russ Allbery ([EMAIL PROTECTED])             <http://www.eyrie.org/~eagle/>


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to