diff -ruN debconf-1.5.52.orig/Debconf/Client/ConfModule.pm debconf-1.5.52/Debconf/Client/ConfModule.pm
--- debconf-1.5.52.orig/Debconf/Client/ConfModule.pm	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/Debconf/Client/ConfModule.pm	2013-11-21 08:49:24.000000000 -0700
@@ -73,9 +73,9 @@
 		$ENV{PERL_DL_NONLAZY}=1;
 		if (exists $ENV{DEBCONF_USE_CDEBCONF} and
 		    $ENV{DEBCONF_USE_CDEBCONF} ne '') {
-			exec "/usr/lib/cdebconf/debconf", $0, @ARGV;
+			exec "@FINKPREFIX@/lib/cdebconf/debconf", $0, @ARGV;
 		} else {
-			exec "/usr/share/debconf/frontend", $0, @ARGV;
+			exec "@FINKPREFIX@/share/debconf/frontend", $0, @ARGV;
 		}
 	}
 
@@ -83,7 +83,7 @@
 	Debconf::Client::ConfModule->export_to_level(1, @_);
 
 	# A truly gross hack. This is only needed if
-	# /usr/share/debconf/confmodule is loaded, and then this
+	# @FINKPREFIX@/share/debconf/confmodule is loaded, and then this
 	# perl module is used. In that case, this module needs to write
 	# to fd #3, rather than stdout. See changelog 0.3.74.
 	if (exists $ENV{DEBCONF_REDIR} && $ENV{DEBCONF_REDIR}) {
@@ -153,7 +153,7 @@
 =head1 SEE ALSO
 
 The debconf specification
-(/usr/share/doc/debian-policy/debconf_specification.txt.gz).
+(@FINKPREFIX@/share/doc/debian-policy/debconf_specification.txt.gz).
 
 =head1 AUTHOR
 
diff -ruN debconf-1.5.52.orig/Debconf/Config.pm debconf-1.5.52/Debconf/Config.pm
--- debconf-1.5.52.orig/Debconf/Config.pm	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/Debconf/Config.pm	2013-11-21 08:49:24.000000000 -0700
@@ -19,7 +19,7 @@
               noninteractive_seen c_values);
 our $config=fields::new('Debconf::Config');
 
-our @config_files=("/etc/debconf.conf", "/usr/share/debconf/debconf.conf");
+our @config_files=("@FINKPREFIX@/etc/debconf.conf", "@FINKPREFIX@/share/debconf/debconf.conf");
 if ($ENV{DEBCONF_SYSTEMRC}) {
 	unshift @config_files, $ENV{DEBCONF_SYSTEMRC};
 } else {
diff -ruN debconf-1.5.52.orig/Debconf/FrontEnd/Editor.pm debconf-1.5.52/Debconf/FrontEnd/Editor.pm
--- debconf-1.5.52.orig/Debconf/FrontEnd/Editor.pm	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/Debconf/FrontEnd/Editor.pm	2013-11-21 08:49:24.000000000 -0700
@@ -113,7 +113,7 @@
 	close $fh;
 	
 	# Launch editor.
-	my $editor=$ENV{EDITOR} || $ENV{VISUAL} || '/usr/bin/editor';
+	my $editor=$ENV{EDITOR} || $ENV{VISUAL} || '@FINKPREFIX@/bin/editor';
 	# $editor may possibly contain spaces and options
 	system "$editor ".Debconf::TmpFile->filename;
 
diff -ruN debconf-1.5.52.orig/Debconf/FrontEnd/Gnome.pm debconf-1.5.52/Debconf/FrontEnd/Gnome.pm
--- debconf-1.5.52.orig/Debconf/FrontEnd/Gnome.pm	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/Debconf/FrontEnd/Gnome.pm	2013-11-21 08:49:24.000000000 -0700
@@ -165,11 +165,11 @@
 	if (system('type lsb_release >/dev/null 2>&1') == 0) {
 		$distribution=lc(`lsb_release -is`);
 		chomp $distribution;
-	} elsif (-e '/etc/debian_version') {
+	} else {
 		$distribution='debian';
 	}
 
-	my $logo="/usr/share/pixmaps/$distribution-logo.png";
+	my $logo="@FINKPREFIX@/share/pixmaps/$distribution-logo.png";
 	if (-e $logo) {
 		$this->logo(Gtk2::Gdk::Pixbuf->new_from_file($logo));
 	}
diff -ruN debconf-1.5.52.orig/Makefile debconf-1.5.52/Makefile
--- debconf-1.5.52.orig/Makefile	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/Makefile	2013-11-21 08:49:24.000000000 -0700
@@ -26,60 +26,60 @@
 
 # Anything that goes in the debconf-utils package.
 install-utils:
-	install -d $(prefix)/usr/bin
-	find . -maxdepth 1 -perm /100 -type f -name 'debconf-*' | grep -v debconf-set-selections | grep -v debconf-show | grep -v debconf-copydb | grep -v debconf-communicate | grep -v debconf-apt-progress | grep -v debconf-escape | \
-		xargs -i install {} $(prefix)/usr/bin
+	install -d $(prefix)/bin
+	find . -maxdepth 1 -perm -100 -type f -name 'debconf-*' | grep -v debconf-set-selections | grep -v debconf-show | grep -v debconf-copydb | grep -v debconf-communicate | grep -v debconf-apt-progress | grep -v debconf-escape | \
+		xargs -i install {} $(prefix)/bin
 
 # Anything that goes in the debconf-i18n package.
 install-i18n:
 	$(MAKE) -C po install
 
 # This would probably be easier if we used setup.py ...
-PYTHON2_SUPPORTED := $(shell pyversions -s)
-PYTHON_SITEDIR = $(prefix)/usr/lib/$(1)/$(if $(filter 2.0 2.1 2.2 2.3 2.4 2.5,$(patsubst python%,%,$(1))),site-packages,dist-packages)
+PYTHON2_SUPPORTED := python2.7
+PYTHON_SITEDIR = $(prefix)/lib/$(1)/$(if $(filter 2.0 2.1 2.2 2.3 2.4 2.5,$(patsubst python%,%,$(1))),site-packages,dist-packages)
 
 # Install all else.
 install-rest:
 	install -d $(prefix)/etc \
 		$(prefix)/var/cache/debconf \
-		$(prefix)/usr/share/debconf \
-		$(prefix)/usr/share/pixmaps
+		$(prefix)/share/debconf \
+		$(prefix)/share/pixmaps
 	install -m 0644 debconf.conf $(prefix)/etc/
-	install -m 0644 debian-logo.png $(prefix)/usr/share/pixmaps/
+	install -m 0644 debian-logo.png $(prefix)/share/pixmaps/
 	# This one is the ultimate backup copy.
-	grep -v '^#' debconf.conf > $(prefix)/usr/share/debconf/debconf.conf
+	grep -v '^#' debconf.conf > $(prefix)/share/debconf/debconf.conf
 	#build the Qt ui file
 	cd $(CURDIR)/Debconf/FrontEnd/Kde/ && bash generateui.sh
 	# Make module directories.
 	find Debconf -type d |grep -v CVS | \
-		xargs -i install -d $(prefix)/usr/share/perl5/{}
+		xargs -i install -d $(prefix)/share/perl5/{}
 	# Install modules.
 	find Debconf -type f -name '*.pm' |grep -v CVS | \
-		xargs -i install -m 0644 {} $(prefix)/usr/share/perl5/{}
+		xargs -i install -m 0644 {} $(prefix)/share/perl5/{}
 	set -e; for dir in $(foreach python,$(PYTHON2_SUPPORTED),$(call PYTHON_SITEDIR,$(python))); do \
 		install -d $$dir; \
 		install -m 0644 debconf.py $$dir/; \
 	done
-	install -d $(prefix)/usr/lib/python3/dist-packages
-	install -m 0644 debconf.py $(prefix)/usr/lib/python3/dist-packages/
+	install -d $(prefix)/lib/python3/dist-packages
+	install -m 0644 debconf.py $(prefix)/lib/python3/dist-packages/
 	# Special case for back-compatability.
-	install -d $(prefix)/usr/share/perl5/Debian/DebConf/Client
+	install -d $(prefix)/share/perl5/Debian/DebConf/Client
 	cp Debconf/Client/ConfModule.stub \
-		$(prefix)/usr/share/perl5/Debian/DebConf/Client/ConfModule.pm
+		$(prefix)/share/perl5/Debian/DebConf/Client/ConfModule.pm
 	# Other libs and helper stuff.
-	install -m 0644 confmodule.sh confmodule $(prefix)/usr/share/debconf/
-	install frontend $(prefix)/usr/share/debconf/
-	install -m 0755 transition_db.pl fix_db.pl $(prefix)/usr/share/debconf/
+	install -m 0644 confmodule.sh confmodule $(prefix)/share/debconf/
+	install frontend $(prefix)/share/debconf/
+	install -m 0755 transition_db.pl fix_db.pl $(prefix)/share/debconf/
 	# Install essential programs.
-	install -d $(prefix)/usr/sbin $(prefix)/usr/bin
-	find . -maxdepth 1 -perm /100 -type f -name 'dpkg-*' | \
-		xargs -i install {} $(prefix)/usr/sbin
-	find . -maxdepth 1 -perm /100 -type f -name debconf -or -name debconf-show -or -name debconf-copydb -or -name debconf-communicate -or -name debconf-set-selections -or -name debconf-apt-progress -or -name debconf-escape | \
-		xargs -i install {} $(prefix)/usr/bin
+	install -d $(prefix)/sbin $(prefix)/bin
+	find . -maxdepth 1 -perm -100 -type f -name 'dpkg-*' | \
+		xargs -i install {} $(prefix)/sbin
+	find . -maxdepth 1 -perm -100 -type f -name debconf.tmp -or -name debconf-show -or -name debconf-copydb -or -name debconf-communicate -or -name debconf-set-selections -or -name debconf-apt-progress -or -name debconf-escape | \
+		xargs -i install {} $(prefix)/bin
 	# Now strip all pod documentation from all .pm files and scripts.
-	find $(prefix)/usr/share/perl5/ $(prefix)/usr/sbin		\
-	     $(prefix)/usr/share/debconf/frontend 			\
-	     $(prefix)/usr/share/debconf/*.pl $(prefix)/usr/bin		\
+	find $(prefix)/share/perl5/ $(prefix)/sbin		\
+	     $(prefix)/share/debconf/frontend 			\
+	     $(prefix)/share/debconf/*.pl $(prefix)/bin		\
 	     -name '*.pl' -or -name '*.pm' -or -name 'dpkg-*' -or	\
 	     -name 'debconf-*' -or -name 'frontend' | 			\
 	     grep -v Client/ConfModule | $(MUNGE)
diff -ruN debconf-1.5.52.orig/Test/Debconf/DbDriver/SLAPD.pm debconf-1.5.52/Test/Debconf/DbDriver/SLAPD.pm
--- debconf-1.5.52.orig/Test/Debconf/DbDriver/SLAPD.pm	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/Test/Debconf/DbDriver/SLAPD.pm	2013-11-21 08:49:24.000000000 -0700
@@ -39,8 +39,8 @@
 	#
 	# start local slapd daemon for testing
 	#
-	my $slapdbin = '/usr/sbin/slapd';
-	my $slapaddbin = '/usr/sbin/slapadd';
+	my $slapdbin = '@FINKPREFIX@/sbin/slapd';
+	my $slapaddbin = '@FINKPREFIX@/sbin/slapadd';
 
 	# is there slapd installed?
 	if (! -x $slapdbin) {
@@ -98,11 +98,11 @@
 # This is the main ldapd configuration file. See slapd.conf(5) for more
 # info on the configuration options.
 
-modulepath      /usr/lib/ldap
+modulepath      @FINKPREFIX@/lib/ldap
 moduleload      back_ldbm
 
 # Schema and objectClass definitions
-include         /etc/ldap/schema/core.schema
+include         @FINKPREFIX@/etc/ldap/schema/core.schema
 include         doc/debconf.schema
 
 # Schema check allows for forcing entries to
diff -ruN debconf-1.5.52.orig/Test/Debconf/DbDriver/ldap/slapd.conf debconf-1.5.52/Test/Debconf/DbDriver/ldap/slapd.conf
--- debconf-1.5.52.orig/Test/Debconf/DbDriver/ldap/slapd.conf	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/Test/Debconf/DbDriver/ldap/slapd.conf	2013-11-21 08:49:24.000000000 -0700
@@ -1,11 +1,11 @@
 # This is the main ldapd configuration file. See slapd.conf(5) for more
 # info on the configuration options.
 
-modulepath      /usr/lib/ldap
+modulepath      @FINKPREFIX@/lib/ldap
 moduleload      back_ldbm
 
 # Schema and objectClass definitions
-include         /etc/ldap/schema/core.schema
+include         @FINKPREFIX@/etc/ldap/schema/core.schema
 include         doc/debconf.schema
 
 # Schema check allows for forcing entries to
diff -ruN debconf-1.5.52.orig/confmodule debconf-1.5.52/confmodule
--- debconf-1.5.52.orig/confmodule	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/confmodule	2013-11-21 08:49:24.000000000 -0700
@@ -12,9 +12,9 @@
 	# Since there is no FrontEnd, this program execs a FrontEnd.
 	# It will then run a new copy of $0 that can talk to it.
 	if [ "$DEBCONF_USE_CDEBCONF" ]; then
-		exec /usr/lib/cdebconf/debconf $0 "$@"
+		exec @FINKPREFIX@/lib/cdebconf/debconf $0 "$@"
 	else
-		exec /usr/share/debconf/frontend $0 "$@"
+		exec @FINKPREFIX@/share/debconf/frontend $0 "$@"
 	fi
 fi
 
diff -ruN debconf-1.5.52.orig/confmodule.sh debconf-1.5.52/confmodule.sh
--- debconf-1.5.52.orig/confmodule.sh	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/confmodule.sh	2013-11-21 08:49:24.000000000 -0700
@@ -14,7 +14,7 @@
 	# Ok, this is pretty crazy. Since there is no FrontEnd, this
 	# program execs a FrontEnd. It will then run a new copy of $0 that
 	# can talk to it.
-	exec /usr/share/debconf/frontend $0 $*
+	exec @FINKPREFIX@/share/debconf/frontend $0 $*
 fi
 
 # Only do this once.
diff -ruN debconf-1.5.52.orig/debconf-apt-progress debconf-1.5.52/debconf-apt-progress
--- debconf-1.5.52.orig/debconf-apt-progress	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/debconf-apt-progress	2013-11-21 08:49:24.000000000 -0700
@@ -123,7 +123,7 @@
      "$0" debconf
      ;;
    debconf)
-     . /usr/share/debconf/confmodule
+     . @FINKPREFIX@/share/debconf/confmodule
      debconf-apt-progress --start
      debconf-apt-progress --from 0 --to 45 -- apt-get -y install gnome
      debconf-apt-progress --from 45 --to 90 -- apt-get -y install kde
diff -ruN debconf-1.5.52.orig/debconf-get-selections debconf-1.5.52/debconf-get-selections
--- debconf-1.5.52.orig/debconf-get-selections	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/debconf-get-selections	2013-11-21 08:49:24.000000000 -0700
@@ -14,7 +14,7 @@
 debconf-set-selections.
 
 To dump the debconf database of the debian-installer, from
-/var/log/installer/cdebconf, use the --installer
+@FINKPREFIX@/var/log/installer/cdebconf, use the --installer
 parameter.
 
 =cut
@@ -32,10 +32,10 @@
 if (@ARGV && $ARGV[0] eq '--installer') {
 	# A bit of a hack..
 	my $di_path;
-	if (-d "/var/log/installer") {
-		$di_path="/var/log/installer/cdebconf";
+	if (-d "@FINKPREFIX@/var/log/installer") {
+		$di_path="@FINKPREFIX@/var/log/installer/cdebconf";
 	} else {
-		$di_path="/var/log/debian-installer/cdebconf";
+		$di_path="@FINKPREFIX@/var/log/debian-installer/cdebconf";
 	}
 	$Debconf::Db::config=Debconf::Db->makedriver(
 		driver => "File", 
diff -ruN debconf-1.5.52.orig/debconf.conf debconf-1.5.52/debconf.conf
--- debconf-1.5.52.orig/debconf.conf	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/debconf.conf	2013-11-21 08:49:24.000000000 -0700
@@ -16,7 +16,7 @@
 Driver: File
 Mode: 644
 Reject-Type: password
-Filename: /var/cache/debconf/config.dat
+Filename: @FINKPREFIX@/var/cache/debconf/config.dat
 
 # Not world readable (the default), and accepts only passwords.
 Name: passwords
@@ -25,7 +25,7 @@
 Backup: false
 Required: false
 Accept-Type: password
-Filename: /var/cache/debconf/passwords.dat
+Filename: @FINKPREFIX@/var/cache/debconf/passwords.dat
 
 # Set up the configdb database. By default, it consists of a stack of two
 # databases, one to hold passwords and one for everything else.
@@ -38,7 +38,7 @@
 Name: templatedb
 Driver: File
 Mode: 644
-Filename: /var/cache/debconf/templates.dat
+Filename: @FINKPREFIX@/var/cache/debconf/templates.dat
 
 # Well that was pretty straightforward, and it will be enough for most
 # people's needs, but debconf's database drivers can be used to do much
diff -ruN debconf-1.5.52.orig/debconf.py debconf-1.5.52/debconf.py
--- debconf-1.5.52.orig/debconf.py	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/debconf.py	2013-11-21 08:49:24.000000000 -0700
@@ -148,9 +148,9 @@
 
 if ('DEBCONF_USE_CDEBCONF' in os.environ and
     os.environ['DEBCONF_USE_CDEBCONF'] != ''):
-    _frontEndProgram = '/usr/lib/cdebconf/debconf'
+    _frontEndProgram = '@FINKPREFIX@/usr/lib/cdebconf/debconf'
 else:
-    _frontEndProgram = '/usr/share/debconf/frontend'
+    _frontEndProgram = '@FINKPREFIX@/usr/share/debconf/frontend'
 
 def runFrontEnd():
     if 'DEBIAN_HAS_FRONTEND' not in os.environ:
diff -ruN debconf-1.5.52.orig/debian/apt.conf debconf-1.5.52/debian/apt.conf
--- debconf-1.5.52.orig/debian/apt.conf	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/debian/apt.conf	2013-11-21 08:49:24.000000000 -0700
@@ -1,3 +1,3 @@
 // Pre-configure all packages with debconf before they are installed.
 // If you don't like it, comment it out.
-DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};
+DPkg::Pre-Install-Pkgs {"@FINKPREFIX@/sbin/dpkg-preconfigure --apt || true";};
diff -ruN debconf-1.5.52.orig/debian/config debconf-1.5.52/debian/config
--- debconf-1.5.52.orig/debian/config	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/debian/config	2013-11-21 08:49:24.000000000 -0700
@@ -5,11 +5,11 @@
 # file doesn't exist yet, this package is being preconfiged, and
 # we might as well just exit and wait until the postinst
 # runs the config script.
-if [ ! -e /usr/share/debconf/confmodule ]; then
+if [ ! -e @FINKPREFIX@/share/debconf/confmodule ]; then
 	exit
 fi
 
-. /usr/share/debconf/confmodule
+. @FINKPREFIX@/share/debconf/confmodule
 
 db_version 2.0
 db_capb backup
diff -ruN debconf-1.5.52.orig/doc/Makefile debconf-1.5.52/doc/Makefile
--- debconf-1.5.52.orig/doc/Makefile	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/doc/Makefile	2013-11-21 08:49:24.000000000 -0700
@@ -3,7 +3,6 @@
 
 pod2man=pod2man -c Debconf -r '' --utf8
 manpages:
-	cd man && po4a po4a/po4a.cfg
 	for pod in man/*.pod; do \
 		perl -pi -e '/^=encoding/ and $$seen = 1; if (not $$seen and /^=head1/) { print "=encoding UTF-8\n\n"; $$seen = 1; }' $$pod; \
 	done
@@ -14,9 +13,9 @@
 	done
 	$(pod2man) --section=3 ../Debconf/Client/ConfModule.pm \
 		> man/gen/Debconf::Client::ConfModule.3pm
-	find .. -maxdepth 1 -perm /100 -type f \( -name debconf -or -name 'debconf-*' \) -printf '%P\n' | \
+	find .. -maxdepth 1 -perm -100 -type f \( -name debconf -or -name 'debconf-*' \) -printf '%P\n' | \
 		xargs -i sh -c "cd .. ; $(pod2man) --section=1 {} > doc/man/gen/{}.1"
-	find .. -maxdepth 1 -perm /100 -type f -name 'dpkg-*' -printf '%P\n' | \
+	find .. -maxdepth 1 -perm -100 -type f -name 'dpkg-*' -printf '%P\n' | \
 		xargs -i sh -c "cd .. ; $(pod2man) --section=8 {} > doc/man/gen/{}.8"
 
 clean:
diff -ruN debconf-1.5.52.orig/doc/man/po4a/po4a.cfg debconf-1.5.52/doc/man/po4a/po4a.cfg
--- debconf-1.5.52.orig/doc/man/po4a/po4a.cfg	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/doc/man/po4a/po4a.cfg	2013-11-21 08:49:24.000000000 -0700
@@ -2,7 +2,7 @@
 
 [po4a_paths] po4a/po/debconf.pot $lang:po4a/po/$lang.po
 
-[type: pod] ../../debconf \
+[type: pod] ../../debconf.tmp \
     $lang:debconf.$lang.1.pod add_$lang:po4a/add_$lang/addendum.pod.$lang \
     opt:"-L UTF-8"
 [type: pod] ../../Debconf/Client/ConfModule.pm \
diff -ruN debconf-1.5.52.orig/dpkg-reconfigure debconf-1.5.52/dpkg-reconfigure
--- debconf-1.5.52.orig/dpkg-reconfigure	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/dpkg-reconfigure	2013-11-21 08:49:24.000000000 -0700
@@ -77,7 +77,7 @@
 =cut
 
 if (exists $ENV{DEBCONF_USE_CDEBCONF} and $ENV{DEBCONF_USE_CDEBCONF} ne '') {
-    exec "/usr/lib/cdebconf/dpkg-reconfigure", @ARGV;
+    exec "@FINKPREFIX@/lib/cdebconf/dpkg-reconfigure", @ARGV;
 }
 
 use strict;
diff -ruN debconf-1.5.52.orig/dpkg-reconfigure.orig debconf-1.5.52/dpkg-reconfigure.orig
--- debconf-1.5.52.orig/dpkg-reconfigure.orig	1969-12-31 17:00:00.000000000 -0700
+++ debconf-1.5.52/dpkg-reconfigure.orig	2013-09-03 12:44:20.000000000 -0600
@@ -0,0 +1,299 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dpkg-reconfigure - reconfigure an already installed package
+
+=head1 SYNOPSIS
+
+ dpkg-reconfigure [options] packages
+
+=head1 DESCRIPTION
+
+B<dpkg-reconfigure> reconfigures packages after they have already been
+installed. Pass it the names of a package or packages to reconfigure. It
+will ask configuration questions, much like when the package was first
+installed.
+
+If you just want to see the current configuration of a package, see
+L<debconf-show(1)> instead.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-f>I<type>, B<--frontend=>I<type>
+
+Select the frontend to use. The default frontend can be permanently changed
+by:
+
+ dpkg-reconfigure debconf
+
+Note that if you normally have debconf set to use the noninteractive
+frontend, dpkg-reconfigure will use the dialog frontend instead, so you
+actually get to reconfigure the package.
+
+=item B<-p>I<value>, B<--priority=>I<value>
+
+Specify the minimum priority of question that will be displayed.
+dpkg-reconfigure normally shows low priority questions no matter what your
+default priority is. See L<debconf(7)> for a list.
+
+=item B<--default-priority>
+
+Use whatever the default priority of question is, instead of forcing the
+priority to low.
+
+=item B<-u>, B<--unseen-only>
+
+By default, all questions are shown, even if they have already been
+answered. If this parameter is set though, only questions that have not yet
+been seen will be asked.
+
+=item B<--force>
+
+Force dpkg-reconfigure to reconfigure a package even if the package is in an
+inconsistent or broken state. Use with caution.
+
+=item B<--no-reload>
+
+Prevent dpkg-reconfigure from reloading templates. Use with caution; this
+will prevent dpkg-reconfigure from repairing broken templates databases.
+However, it may be useful in constrained environments where rewriting the
+templates database is expensive.
+
+=item B<-h>, B<--help>
+
+Display usage help.
+
+=back
+
+=cut
+
+=head1 SEE ALSO
+
+L<debconf(7)>
+
+=cut
+
+if (exists $ENV{DEBCONF_USE_CDEBCONF} and $ENV{DEBCONF_USE_CDEBCONF} ne '') {
+    exec "/usr/lib/cdebconf/dpkg-reconfigure", @ARGV;
+}
+
+use strict;
+use Debconf::Db;
+use Debconf::Gettext;
+use Debconf::Template;
+use Debconf::Config;
+use Debconf::AutoSelect qw(:all);
+use Debconf::Log qw(:all);
+
+# Use low priority unless an option below overrides.
+Debconf::Config->priority('low');
+
+my $unseen_only=0;
+my $force=0;
+my $default_priority=0;
+my $reload=1;
+Debconf::Config->getopt(
+gettext(qq{Usage: dpkg-reconfigure [options] packages
+  -u,  --unseen-only		Show only not yet seen questions.
+       --default-priority	Use default priority instead of low.
+       --force			Force reconfiguration of broken packages.
+       --no-reload		Do not reload templates. (Use with caution.)}),
+	"unseen-only|u"		=> \$unseen_only,
+	"default-priority"	=> \$default_priority,
+	"force"			=> \$force,
+	"reload!"		=> \$reload,
+);
+
+if ($> != 0) {
+	print STDERR sprintf(gettext("%s must be run as root"), $0)."\n";
+	exit 1;
+}
+
+Debconf::Db->load;
+
+if ($default_priority) {
+	Debconf::Config->priority(Debconf::Question->get('debconf/priority')->value);
+}
+
+# If the frontend is noninteractive, change it temporarily to dialog.
+if (lc Debconf::Config->frontend eq 'noninteractive' &&
+    ! Debconf::Config->frontend_forced) {
+	Debconf::Config->frontend('dialog');
+}
+
+my $frontend=make_frontend();
+
+unless ($unseen_only) {
+	# Make the frontend show questions even if the user has already seen
+	# them. Since this is a reconfigure program, they may want to change
+	# their choices.
+	Debconf::Config->reshow(1);
+}
+
+my @packages=@ARGV;
+if (! @packages) {
+	print STDERR "$0: ".gettext("please specify a package to reconfigure")."\n";
+	exit 1;
+}
+
+# This is a hack to let postinsts know when they're being reconfigured. It
+# would of course be better to pass them "reconfigure", but we can't for
+# hysterical raisens.
+$ENV{DEBCONF_RECONFIGURE}=1;
+
+my %initial_triggers=map { $_ => 1 } triggers_pending();
+
+foreach my $pkg (@packages) {
+	# Set default title.
+	$frontend->default_title($pkg);
+	$frontend->info(undef);
+
+	# Get the package version. Also check to make sure it is installed.
+	$_=`dpkg --status $pkg`;
+	my ($version)=m/Version: (.*)\n/;
+	my ($status)=m/Status: (.*)\n/;
+	my ($package)=m/Package: (.*)\n/;
+	my ($arch)=m/Architecture: (.*)\n/;
+	if (! $force) {
+		if (! defined $status || $status =~ m/not-installed$/) {
+			print STDERR "$0: ".sprintf(gettext("%s is not installed"), $pkg)."\n";
+			exit 1;
+		}
+		if ($status !~ m/ ok installed$/) {
+			print STDERR "$0: ".sprintf(gettext("%s is broken or not fully installed"), $pkg)."\n";
+			exit 1;
+		}
+	}
+	
+	my @control_paths=`dpkg-query --control-path $pkg`;
+	map chomp, @control_paths;
+	my $control_path = sub {
+		my $file = shift;
+		my $path = (grep /\.\Q$file\E$/, @control_paths)[0];
+		chomp($path) if defined $path;
+		return $path;
+	};
+
+	if ($reload) {
+		# Load up templates just in case they aren't already.
+		my $templates=$control_path->('templates');
+		if ($templates and -e $templates) {
+			Debconf::Template->load($templates, $pkg);
+		}
+	}
+
+	# Simulation of reinstalling a package, without bothering with
+	# removing the files and putting them back. Just like in a regular
+	# reinstall, run config, and postinst scripts in sequence, with args.
+	# Do not run postrm, because the postrm can depend on the package's
+	# files actually being gone already.
+	foreach my $info (['prerm',    'upgrade',     $version],
+		          ['config',   'reconfigure', $version],
+			  ['postinst', 'configure',   $version]) {
+		my $script=shift @$info;
+		my $path_script=$control_path->($script);
+
+		next unless $path_script and -x $path_script;
+
+		my $is_confmodule='';
+
+		# Set environment variables expected by maintainer scripts
+		$ENV{DPKG_MAINTSCRIPT_PACKAGE}=$package;
+		$ENV{DPKG_MAINTSCRIPT_ARCH}=$arch;
+		$ENV{DPKG_MAINTSCRIPT_NAME}=$script;
+
+		if ($script ne 'config') {
+			# Test to see if the script uses debconf.
+			open (IN, "<$path_script");
+			while (<IN>) {
+				if (/confmodule/i) {
+					$is_confmodule=1;
+					last;
+				}
+			}
+			close IN;
+		}
+		
+		if ($script eq 'config' || $is_confmodule) {
+			# Start up the confmodule.
+			my $confmodule=make_confmodule($path_script, @$info);
+	
+			# Make sure any questions the confmodule registers
+			# are owned by this package.
+			$confmodule->owner($pkg);
+		
+			# Talk to it until it is done.
+			1 while ($confmodule->communicate);
+	
+			exit $confmodule->exitcode if $confmodule->exitcode > 0;
+		}
+		else {
+			# Not a confmodule, so run it as a normal script.
+			run_external($path_script, @$info);
+		}
+	}
+}
+
+# Maintainer scripts may have activated triggers.  If so, try to process
+# them.
+my @new_triggers;
+do {
+	@new_triggers=();
+	foreach my $trigpend (triggers_pending()) {
+		push @new_triggers, $trigpend
+			if not exists $initial_triggers{$trigpend};
+	}
+	if (@new_triggers) {
+		run_external("dpkg", "--configure", @new_triggers);
+	}
+} while (@new_triggers);
+
+$frontend->shutdown;
+
+Debconf::Db->save;
+
+# Run an external program that does not itself use debconf, but that may run
+# other programs that do use debconf.  To do this safely, checkpoint the
+# current database state and re-initialize it when the program finishes.
+sub run_external {
+	Debconf::Db->save;
+	
+	delete $ENV{DEBIAN_HAS_FRONTEND};
+	my $ret=system(@_);
+	if (int($ret / 256) != 0) {
+		exit int($ret / 256);
+	}
+	$ENV{DEBIAN_HAS_FRONTEND}=1;
+	
+	Debconf::Db->load;
+}
+
+# Returns a list of all packages with pending triggers.
+sub triggers_pending {
+	my @ret;
+	local $_;
+
+	open (QUERY, '-|', 'dpkg-query', '-W',
+		'-f', '${Package} ${binary:Package}\t${Triggers-Pending}\n');
+	while (<QUERY>) {
+		chomp;
+		my ($pkgnames, $triggers) = split /\t/;
+		if (length $triggers) {
+			# Handle multiarch.
+			my ($pkg, $binpkg) = split ' ', $pkgnames;
+			push @ret, (length $binpkg ? $binpkg : $pkg);
+		}
+	}
+	close QUERY;
+
+	return @ret;
+}
+
+=head1 AUTHOR
+
+Joey Hess <joeyh@debian.org>
+
+=cut
diff -ruN debconf-1.5.52.orig/fix_db.pl debconf-1.5.52/fix_db.pl
--- debconf-1.5.52.orig/fix_db.pl	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/fix_db.pl	2013-11-21 08:49:24.000000000 -0700
@@ -89,8 +89,8 @@
 # templates belonging to all installed packages all over again.
 # This also means that if any of the stuff above resulted in a necessary
 # question and template being deleted, it will be reinstated now.
-foreach my $templatefile (glob("/var/lib/dpkg/info/*.templates")) {
-	my ($package) = $templatefile =~ m:/var/lib/dpkg/info/(.*?).templates:;
+foreach my $templatefile (glob("@FINKPREFIX@/var/lib/dpkg/info/*.templates")) {
+	my ($package) = $templatefile =~ m:@FINKPREFIX@/var/lib/dpkg/info/(.*?).templates:;
         Debconf::Template->load($templatefile, $package);
 }
 
diff -ruN debconf-1.5.52.orig/frontend debconf-1.5.52/frontend
--- debconf-1.5.52.orig/frontend	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/frontend	2013-11-21 08:49:24.000000000 -0700
@@ -44,10 +44,10 @@
 	# Avoid spurious title updates with triggered actions:
 	$no_title=1 if $action eq 'triggered';
 }
-elsif (-e "/var/lib/dpkg/tmp.ci/control") {
+elsif (-e "@FINKPREFIX@/var/lib/dpkg/tmp.ci/control") {
 	# The preinst is running, presumably. Now it gets really ugly, because
 	# I have to parse the control file.
-	open (CONTROL, "< /var/lib/dpkg/tmp.ci/control")
+	open (CONTROL, "< @FINKPREFIX@/var/lib/dpkg/tmp.ci/control")
 		|| die "Debconf: unable to open control file: $!";
 	while (<CONTROL>) {
 		if (/^Package: (.*)/) {
@@ -86,7 +86,7 @@
 		unless ($ARGV[0]=~m/(.*)config$/ && trytemplate("${1}templates")) {
 			# Finally, look in debconf lib directory for the base
 			# filename with .templates appended.
-			unless ($ARGV[0]=~m!^(?:.*/)?(.*)! && trytemplate("/usr/share/debconf/templates/${1}.templates")) {
+			unless ($ARGV[0]=~m!^(?:.*/)?(.*)! && trytemplate("@FINKPREFIX@/share/debconf/templates/${1}.templates")) {
 				debug developer => "Couldn't find a templates file."
 			}
 		}
@@ -102,7 +102,7 @@
 # lets you dpkg -i somepackage.deb and have its config script be run first.
 #
 # If it is the preinst, everything is in this weird directory deep in
-# /var/lib/dpkg.
+# @FINKPREFIX@/var/lib/dpkg.
 if ($ARGV[0] =~/^(.*[.\/])(?:postinst|preinst)$/) {
 	my $base=$1;
 
diff -ruN debconf-1.5.52.orig/po/Makefile debconf-1.5.52/po/Makefile
--- debconf-1.5.52.orig/po/Makefile	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/po/Makefile	2013-11-21 08:49:24.000000000 -0700
@@ -1,6 +1,6 @@
 # List here all source files with translatable strings.
 POTFILES=$(sort $(shell find ../Debconf -type f -name \*.pm)) \
-	../dpkg-* ../debconf-* ../debconf
+	../dpkg-* ../debconf-* ../debconf.tmp
 
 POFILES=$(wildcard *.po)
 MOFILES=$(POFILES:.po=.mo)
@@ -10,8 +10,8 @@
 install: all
 	for file in $(MOFILES); do \
 		lang=`echo $$file | sed 's/\.mo//'`; \
-		install -d $(prefix)/usr/share/locale/$$lang/LC_MESSAGES/; \
-		install -m 0644 $$file $(prefix)/usr/share/locale/$$lang/LC_MESSAGES/debconf.mo; \
+		install -d $(prefix)/share/locale/$$lang/LC_MESSAGES/; \
+		install -m 0644 $$file $(prefix)/share/locale/$$lang/LC_MESSAGES/debconf.mo; \
 	done
 
 debconf.pot: $(POTFILES)
diff -ruN debconf-1.5.52.orig/samples/demo debconf-1.5.52/samples/demo
--- debconf-1.5.52.orig/samples/demo	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/samples/demo	2013-11-21 08:49:24.000000000 -0700
@@ -7,7 +7,7 @@
 if [ -e confmodule ]; then
 	. confmodule
 else
-	. /usr/share/debconf/confmodule
+	. @FINKPREFIX@/share/debconf/confmodule
 fi
 
 db_version 2.0
diff -ruN debconf-1.5.52.orig/samples/tutorial debconf-1.5.52/samples/tutorial
--- debconf-1.5.52.orig/samples/tutorial	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/samples/tutorial	2013-11-21 08:49:24.000000000 -0700
@@ -1,7 +1,7 @@
 #!/bin/sh -e
 
 # Source debconf library.
-. /usr/share/debconf/confmodule
+. @FINKPREFIX@/share/debconf/confmodule
 
 # Do you like debian?
 db_input medium foo/like_debian || true
diff -ruN debconf-1.5.52.orig/samples/tutorial-back debconf-1.5.52/samples/tutorial-back
--- debconf-1.5.52.orig/samples/tutorial-back	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/samples/tutorial-back	2013-11-21 08:49:24.000000000 -0700
@@ -1,7 +1,7 @@
 #!/bin/sh -e
 
 # Source debconf library.
-. /usr/share/debconf/confmodule
+. @FINKPREFIX@/share/debconf/confmodule
 db_version 2.0
 
 # This conf script is capable of backing up
diff -ruN debconf-1.5.52.orig/transition_db.pl debconf-1.5.52/transition_db.pl
--- debconf-1.5.52.orig/transition_db.pl	2013-09-03 12:44:20.000000000 -0600
+++ debconf-1.5.52/transition_db.pl	2013-11-21 08:49:24.000000000 -0700
@@ -6,7 +6,7 @@
 use Debconf::Question;
 use Debconf::Template;
 
-my $dir = shift || '/var/lib/debconf';
+my $dir = shift || '@FINKPREFIX@/var/lib/debconf';
 
 Debconf::Db->load;
 
