Package: privoxy Version: 3.0.6-2 Severity: wishlist Tags: patch Hi!
In an attempt to ease the setup of Tor for web browsing, I wanted
privoxy to be configurable without requiring users to edit a
configuration file.
As a possible solution, I added a debconf question to privoxy allowing
the user to automaticaly configure privoxy's forwarding to Tor.
The attached patch carry the following changes:
* Depends on ucf and Build-Depends to po-debconf;
* /etc/privoxy/config is no longer shipped as a conffile and use ucf
instead to allow modification from maintainer scripts;
* on new installation, defaults to Tor configuration if /usr/sbin/tor
is present on the system;
* if /etc/privoxy/config, try to guess about the previous settings.
The package built from this patch was upgrading smoothly from the
current version in my tests.
Please consider including this patch in privoxy. It would really
improve the user experience, IMHO.
Cheers,
--
Jérémy Bobbio .''`.
[EMAIL PROTECTED] : :Ⓐ : # apt-get install anarchism
`. `'`
`-
diff -u privoxy-3.0.6/debian/control privoxy-3.0.6/debian/control
--- privoxy-3.0.6/debian/control
+++ privoxy-3.0.6/debian/control
@@ -2,12 +2,12 @@
Section: web
Priority: optional
Maintainer: Roland Rosenfeld <[EMAIL PROTECTED]>
-Build-Depends: debhelper (>= 5.0.0), autoconf, autotools-dev, libpcre3-dev,
jade, docbook-dsssl, w3m, sp, sgmlspl, groff, htmldoc (>= 1.8.25-1), man2html,
dpatch
+Build-Depends: debhelper (>= 5.0.0), autoconf, autotools-dev, libpcre3-dev,
jade, docbook-dsssl, w3m, sp, sgmlspl, groff, htmldoc (>= 1.8.25-1), man2html,
dpatch, po-debconf
Standards-Version: 3.7.2
Package: privoxy
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, logrotate, adduser
+Depends: ${shlibs:Depends}, ${misc:Depends}, logrotate, adduser, ucf (>= 0.28)
Recommends: doc-base
Description: Privacy enhancing HTTP Proxy
Privoxy is a web proxy with advanced filtering capabilities for
diff -u privoxy-3.0.6/debian/postinst privoxy-3.0.6/debian/postinst
--- privoxy-3.0.6/debian/postinst
+++ privoxy-3.0.6/debian/postinst
@@ -5,6 +5,11 @@
set -e
+. /usr/share/debconf/confmodule
+
+DEFAULT_TOR_LINE="# forward-socks4a / 127.0.0.1:9050 ."
+ENABLED_TOR_LINE="forward-socks4a / 127.0.0.1:9050 ."
+
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
@@ -46,6 +51,31 @@
chown root /etc/privoxy/standard.action \
/etc/privoxy/default.action
fi
+
+ TEMPFILE="`tempfile`"
+ zcat "/usr/share/doc/privoxy/examples/config.gz" > "$TEMPFILE"
+
+ if dpkg --compare-versions "$2" le-nl "3.0.6-2"
+ then
+ # Upgrading from previously non ucf handled "config"
+ echo "537511fb5dd8d913cea82e387a103bdb" > "$TEMPFILE.md5sum"
+ echo "c7938cf2a048205ab751fc638b4ce0a2" >> "$TEMPFILE.md5sum"
+ fi
+
+ db_get privoxy/use-tor
+ USE_TOR="$RET"
+ if [ "$USE_TOR" = "true" ]
+ then
+ sed -e "s,^$DEFAULT_TOR_LINE$,$ENABLED_TOR_LINE," -i "$TEMPFILE"
+ else
+ sed -e
"s,^[[:blank:]]*$ENABLED_TOR_LINE[[:blank:]]*$,$DEFAULT_TOR_LINE," -i
"$TEMPFILE"
+ fi
+
+ ucf --debconf-ok "$TEMPFILE" "/etc/privoxy/config"
+
+ rm -f "$TEMPFILE" "$TEMPFILE.md5sum"
+
+ db_stop || true
;;
abort-upgrade|abort-remove|abort-deconfigure)
diff -u privoxy-3.0.6/debian/postrm privoxy-3.0.6/debian/postrm
--- privoxy-3.0.6/debian/postrm
+++ privoxy-3.0.6/debian/postrm
@@ -22,6 +22,10 @@
purge)
deluser --quiet privoxy
rm -rf /var/log/privoxy /etc/privoxy
+ # Remove /etc/privoxy/config from ucf's database if ucf is available
+ if [ -x /usr/bin/ucf ]; then
+ ucf --purge /etc/privoxy/config
+ fi
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
diff -u privoxy-3.0.6/debian/rules privoxy-3.0.6/debian/rules
--- privoxy-3.0.6/debian/rules
+++ privoxy-3.0.6/debian/rules
@@ -69,6 +69,8 @@
rm -rf doc/source/temp
# rm -rf doc/pdf
+ debconf-updatepo
+
dh_clean -Xrc.privoxy.orig
install: build-stamp
@@ -79,7 +81,6 @@
install -m 0755 privoxy $(DEBDIR)/usr/sbin/privoxy
- install -m 644 config $(DEBDIR)/etc/privoxy/config
install -m 0644 default.action $(DEBDIR)/etc/privoxy/default.action
install -m 0644 global.action $(DEBDIR)/etc/privoxy/global.action
install -m 0644 standard.action $(DEBDIR)/etc/privoxy/standard.action
@@ -110,7 +111,7 @@
binary-arch: build-stamp install
dh_testdir
dh_testroot
-# dh_installdebconf
+ dh_installdebconf
dh_installdocs -XCVS
(cd $(DEBDIR)/usr/share/doc/privoxy/; \
mv privoxy-index.html index.html)
only in patch2:
unchanged:
--- privoxy-3.0.6.orig/debian/examples
+++ privoxy-3.0.6/debian/examples
@@ -0,0 +1 @@
+config
only in patch2:
unchanged:
--- privoxy-3.0.6.orig/debian/config
+++ privoxy-3.0.6/debian/config
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+CONFIGFILE="/etc/privoxy/config"
+
+if [ -e "$CONFIGFILE" ]; then
+ if grep -Eq
'^[[:blank:]]*forward-socks4a[[:blank:]]*/[[:blank:]]*127.0.0.1:9050[[:blank:]]*\.'
"$CONFIGFILE"; then
+ db_set privoxy/use-tor true
+ else
+ db_set privoxy/use-tor false
+ fi
+fi
+
+# Only on new installation
+if [ -z "$2" ]; then
+ if [ -x /usr/sbin/tor ]; then
+ db_set privoxy/use-tor true
+ else
+ db_set privoxy/use-tor false
+ fi
+fi
+
+db_input medium privoxy/use-tor || true
+db_go || true
+
+# vim: et sw=4
only in patch2:
unchanged:
--- privoxy-3.0.6.orig/debian/po/POTFILES.in
+++ privoxy-3.0.6/debian/po/POTFILES.in
@@ -0,0 +1 @@
+[type: gettext/rfc822deb] templates
only in patch2:
unchanged:
--- privoxy-3.0.6.orig/debian/po/templates.pot
+++ privoxy-3.0.6/debian/po/templates.pot
@@ -0,0 +1,37 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <[EMAIL PROTECTED]>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: [EMAIL PROTECTED]"
+"POT-Creation-Date: 2007-04-26 18:07+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <[EMAIL PROTECTED]>\n"
+"Language-Team: LANGUAGE <[EMAIL PROTECTED]>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: boolean
+#. Description
+#: ../templates:1001
+msgid "Configure Privoxy to use Tor?"
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../templates:1001
+msgid "Privoxy can use Tor to enhance its privacy protection capabilities."
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../templates:1001
+msgid ""
+"Configuring Privoxy to use Tor is also the recommended way to enable web "
+"browsing through the Tor network."
+msgstr ""
only in patch2:
unchanged:
--- privoxy-3.0.6.orig/debian/templates
+++ privoxy-3.0.6/debian/templates
@@ -0,0 +1,8 @@
+Template: privoxy/use-tor
+Type: boolean
+Default: false
+_Description: Configure Privoxy to use Tor?
+ Privoxy can use Tor to enhance its privacy protection capabilities.
+ .
+ Configuring Privoxy to use Tor is also the recommended way to enable web
+ browsing through the Tor network.
signature.asc
Description: Digital signature

