The option --overwrite-conffiles is added to dpkg. It allows to install the package maintainer's configuration files. If the file has been modified by the user, an backup is stored as .dpkg-old.

--force-confmiss does now work with less code.

Signed-off-by: Daniel Bock <daniel.b...@web.de>
---

Guillem Jover wrote:
I might have missed something but isn't:

   $ dpkg --force-confmiss --force-confnew -i foo.deb

what you are looking for (given the patch you've sent)?

(Regardless of the prospective dpkg-conffile support etc).

regards,
guillem
Patch based on this feedback. I hope you'll like it.

diff -ur ./a/man/dpkg.1 ./b/man/dpkg.1
--- ./a/man/dpkg.1    2010-04-15 13:38:57.000000000 +0200
+++ ./b/man/dpkg.1    2010-07-01 19:29:45.419722074 +0200
@@ -470,6 +470,10 @@
 \-\-no\-act\fP will first purge package foo and then try to purge package
 \-\-no\-act, even though you probably expected it to actually do nothing)
 .TP
+\fB\-\-overwrite-conffiles\fP
+Install the package maintainer's configuration files. If the file has been
+modified by the user, an backup is stored as \fB*.dpkg-old\fP.
+.TP
 \fB\-R\fP, \fB\-\-recursive\fP
 Recursively handle all regular files matching pattern \fB*.deb\fP
 found at specified directories and all of its subdirectories. This can
diff -ur ./a/src/configure.c ./b/src/configure.c
--- ./a/src/configure.c    2010-04-15 13:38:58.000000000 +0200
+++ ./b/src/configure.c    2010-07-02 16:35:49.127267929 +0200
@@ -118,15 +118,6 @@
         useredited = -1;
         distedited = -1;
         what = cfo_identical;
-    } else if (!strcmp(currenthash, NONEXISTENTFLAG) && fc_conff_miss) {
-        fprintf(stderr,
-                _("\n"
-                  "Configuration file `%s', does not exist on system.\n"
-                  "Installing new config file as you requested.\n"),
-                usenode->name);
-        what = cfo_newconff;
-        useredited = -1;
-        distedited = -1;
     } else if (!strcmp(conff->hash, NEWCONFFILEFLAG)) {
         if (!strcmp(currenthash, NONEXISTENTFLAG)) {
             what = cfo_newconff;
@@ -145,6 +136,12 @@
         if (!strcmp(currenthash, NONEXISTENTFLAG))
             what |= cfof_userrmd;
     }
+
+    if (strcmp(currenthash, newdisthash) != 0 && f_overwriteconf
+    || !strcmp(currenthash, NONEXISTENTFLAG) && fc_conff_miss) {
+        what |= cfof_prompt;
+        fc_conff_new = 1;
+    }

     debug(dbg_conff,
"deferred_configure '%s' (= '%s') useredited=%d distedited=%d what=%o",
diff -ur ./a/src/main.c ./b/src/main.c
--- ./a/src/main.c    2010-04-15 13:38:58.000000000 +0200
+++ ./b/src/main.c    2010-07-01 18:54:10.315710869 +0200
@@ -137,6 +137,7 @@
" --log=<filename> Log status changes and actions to <filename>.\n"
 "  --ignore-depends=<package>,...\n"
 "                             Ignore dependencies involving <package>.\n"
+" --overwrite-conffiles Install package maintainer's configuration files\n"
 "  --force-...                Override problems (see --force-help).\n"
 "  --no-force-...|--refuse-...\n"
 "                             Stop when problems encountered.\n"
@@ -175,6 +176,7 @@
 int f_autodeconf=0, f_nodebsig=0;
 int f_triggers = 0;
 unsigned long f_debug=0;
+int f_overwriteconf=0;
 /* Change fc_overwrite to 1 to enable force-overwrite by default */
int fc_downgrade=1, fc_configureany=0, fc_hold=0, fc_removereinstreq=0, fc_overwrite=0; int fc_removeessential=0, fc_conflicts=0, fc_depends=0, fc_dependsversion=0;
@@ -516,6 +518,7 @@
   { "admindir",          0,   1, NULL, &admindir, NULL,          0 },
   { "instdir",           0,   1, NULL, &instdir,  NULL,          0 },
{ "ignore-depends", 0, 1, NULL, NULL, ignoredepends, 0 },
+  { "overwrite-conffiles", 0, 0, &f_overwriteconf, NULL,   NULL,    1 },
{ "force", 0, 2, NULL, NULL, setforce, 1 }, { "refuse", 0, 2, NULL, NULL, setforce, 0 }, { "no-force", 0, 2, NULL, NULL, setforce, 0 },
diff -ur ./a/src/main.h ./b/src/main.h
--- ./a/src/main.h    2010-04-15 13:38:58.000000000 +0200
+++ ./b/src/main.h    2010-06-29 18:10:22.676904835 +0200
@@ -117,6 +117,7 @@
 extern int f_autodeconf, f_nodebsig;
 extern int f_triggers;
 extern unsigned long f_debug;
+extern int f_overwriteconf;
extern int fc_downgrade, fc_configureany, fc_hold, fc_removereinstreq, fc_overwrite; extern int fc_removeessential, fc_conflicts, fc_depends, fc_dependsversion;
 extern int fc_breaks, fc_badpath, fc_overwritediverted, fc_architecture;


--
To UNSUBSCRIBE, email to debian-dpkg-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4c2dfbb0.2090...@web.de

Reply via email to