Package: privoxy Version: 3.0.23-3 Severity: wishlist Tags: patch Dear Maintainer,
Please consider adding debconf support to privoxy, specifically for setting the listen-address. This change is needed for FreedomBox to offer smooth upgrades to our users. The attached patch does this as follows: 1. The config shipped with privoxy is installed under /usr/share/privoxy instead of /etc/privoxy. 2. Debconf can ask for listen-address, with localhost:8118 as the default. The question priority is medium, so it won't be shown to those with the default debconf settings. 3. ucf is used to merge config updates during upgrades. Some more background on why this is needed: FreedomBox (through its user interface, plinth) can install privoxy and configure it to be available to client devices on the LAN (by setting listen-address). But currently, our changes to /etc/privoxy/config make it difficult to upgrade privoxy, because it will ask which config file to keep. If plinth can configure privoxy solely through debconf, then upgrades can be done without prompting (via unattended-upgrades), and our users can also receive any updates that are made to the packaged config. -- James
diff --git a/debian/config b/debian/config
new file mode 100755
index 0000000..bfda17a
--- /dev/null
+++ b/debian/config
@@ -0,0 +1,16 @@
+#!/bin/sh
+CONFIG=/etc/privoxy/config
+set -e
+. /usr/share/debconf/confmodule
+
+# Load config file, if it exists.
+if [ -e $CONFIG ]; then
+ LISTENADDRESS=$(awk '/^listen-address/ {print $2}' $CONFIG)
+
+ # Store values from config file into debconf db.
+ db_set privoxy/listen-address "$LISTENADDRESS"
+fi
+
+# Ask questions.
+db_input medium privoxy/listen-address || true
+db_go || true
diff --git a/debian/control b/debian/control
index d1d478d..c74c1ba 100644
--- a/debian/control
+++ b/debian/control
@@ -4,14 +4,14 @@ Priority: optional
Maintainer: Roland Rosenfeld <[email protected]>
Build-Depends: debhelper (>= 9), autoconf, autotools-dev, libpcre3-dev,
jade, docbook-dsssl, docbook, w3m, sp, sgmlspl, groff, man2html, zlib1g-dev,
- dh-systemd (>= 1.4)
+ dh-systemd (>= 1.4), po-debconf
Standards-Version: 3.9.6
Homepage: http://www.privoxy.org/
Package: privoxy
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, logrotate,
- adduser, lsb-base (>= 3.2-13), initscripts (>= 2.87dsf-8)
+ adduser, lsb-base (>= 3.2-13), initscripts (>= 2.87dsf-8), debconf, ucf
Recommends: doc-base
Description: Privacy enhancing HTTP Proxy
Privoxy is a web proxy with advanced filtering capabilities for
diff --git a/debian/install b/debian/install
new file mode 100644
index 0000000..a1729f0
--- /dev/null
+++ b/debian/install
@@ -0,0 +1 @@
+config usr/share/privoxy
diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in
new file mode 100644
index 0000000..98e8416
--- /dev/null
+++ b/debian/po/POTFILES.in
@@ -0,0 +1 @@
+[type: gettext/rfc822deb] templates
\ No newline at end of file
diff --git a/debian/po/templates.pot b/debian/po/templates.pot
new file mode 100644
index 0000000..c8a2543
--- /dev/null
+++ b/debian/po/templates.pot
@@ -0,0 +1,24 @@
+# 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@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: privoxy\n"
+"Report-Msgid-Bugs-To: [email protected]\n"
+"POT-Creation-Date: 2015-09-05 19:17-0400\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <[email protected]>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "Address and TCP port on which Privoxy will listen for client requests:"
+msgstr ""
diff --git a/debian/postinst b/debian/postinst
index f55b3c8..5467504 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -25,6 +25,9 @@ set -e
CONFDIR=/etc/privoxy
CONFIG=$CONFDIR/config
+EXAMPLE_CONFIG=/usr/share/privoxy/config
+
+. /usr/share/debconf/confmodule
case "$1" in
configure)
@@ -36,6 +39,13 @@ case "$1" in
[ -f $CONFDIR/match-all.action ] \
&& chown privoxy $CONFDIR/match-all.action
+ cp -a -f $EXAMPLE_CONFIG $CONFIG.ucftmp
+ db_get privoxy/listen-address || true
+ sed -i "s/^listen-address.*/listen-address $RET/" $CONFIG.ucftmp
+ ucf --three-way --debconf-ok $CONFIG.ucftmp $CONFIG
+ ucfr privoxy $CONFIG
+ rm -f $CONFIG.ucftmp
+
if [ "x$2" != "x" ] && dpkg --compare-versions "$2" lt "3.0.4"
then
# Upgrading from a 3.0.3* version
diff --git a/debian/postrm b/debian/postrm
index 3b761d0..afd3038 100644
--- a/debian/postrm
+++ b/debian/postrm
@@ -21,7 +21,17 @@ set -e
case "$1" in
purge)
# deluser --quiet privoxy
+ if [ -x "$(which ucf 2>/dev/null)" ]; then
+ ucf --purge /etc/privoxy/config
+ fi
+ if [ -x "$(which ucfr 2>/dev/null)" ]; then
+ ucfr --purge privoxy /etc/privoxy/config
+ fi
rm -rf /var/log/privoxy /etc/privoxy
+ if [ -e /usr/share/debconf/confmodule ]; then
+ . /usr/share/debconf/confmodule
+ db_purge
+ fi
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
diff --git a/debian/rules b/debian/rules
index 286a79c..dfd6bed 100755
--- a/debian/rules
+++ b/debian/rules
@@ -51,7 +51,6 @@ override_dh_auto_clean:
override_dh_auto_install:
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 match-all.action $(DEBDIR)/etc/privoxy/match-all.action
install -m 0644 user.action $(DEBDIR)/etc/privoxy/user.action
diff --git a/debian/templates b/debian/templates
new file mode 100644
index 0000000..b42052b
--- /dev/null
+++ b/debian/templates
@@ -0,0 +1,4 @@
+Template: privoxy/listen-address
+Type: string
+Default: localhost:8118
+_Description: Address and TCP port on which Privoxy will listen for client requests:
signature.asc
Description: OpenPGP digital signature

