dpkg: option to install package maintainer's configuration files
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 backups is stored as .dpkg-old.
Signed-off-by: Daniel Bock <daniel.bock@web.de>
---
diff -upr ./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 @@ end up with undesirable results. (e.g.
--no-actfP 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-conffilesfP
+Install the package maintainer's configuration files. If the file has been
+modified by the user, an backup is stored as fB*.dpkg-oldfP.
+.TP
fB-RfP, fB--recursivefP
Recursively handle all regular files matching pattern fB*.debfP
found at specified directories and all of its subdirectories. This can
diff -upr ./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-01 19:30:15.607692547 +0200
@@ -145,6 +145,24 @@ deferred_configure_conffile(struct pkgin
if (!strcmp(currenthash, NONEXISTENTFLAG))
what |= cfof_userrmd;
}
+
+ if (strcmp(currenthash, newdisthash) != 0 && f_overwriteconf) {
+ if (useredited) {
+ fprintf(stderr, "
");
+
+ fprintf(stderr, !(what & cfof_userrmd) ?
+ _("Configuration file '%s' has been modified.
") :
+ _("Configuration file '%s' has been deleted.
"),
+ usenode->name);
+
+ fprintf(stderr, _("Installing package maintainer's"
+ " version of configuration file"
+ " as you requested.
"));
+ what &= cfof_userrmd;
+ what |= cfo_install | cfof_backup;
+ } else
+ what = cfo_newconff;
+ }
diff -upr ./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_pending, f_recursive, f_als
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-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4C2CD33A.3030501@web.de">http://lists.debian.org/4C2CD33A.3030501@web.de