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; + } debug(dbg_conff, "deferred_configure '%s' (= '%s') useredited=%d distedited=%d what=%o", @@ -189,8 +207,9 @@ deferred_configure_conffile(struct pkgin pkg->name, cdr.buf, cdr2.buf, strerror(errno)); /* Fall through. */ case cfo_install: - printf(_("Installing new version of config file %s ... "), - usenode->name); + if (!(f_overwriteconf && useredited)) + printf(_("Installing new version of config file %s ... "), + usenode->name); case cfo_newconff: strcpy(cdr2rest, DPKGNEWEXT); trig_file_activate(usenode, pkg); diff -upr ./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 @@ usage(const struct cmdinfo *ci, const ch " --log=<filename> Log status changes and actions to <filename>. " " --ignore-depends=<package>,... " " Ignore dependencies involving <package>. " +" --overwrite-conffiles Install package maintainer's configuration files " " --force-... Override problems (see --force-help). " " --no-force-...|--refuse-... " " Stop when problems encountered. " @@ -175,6 +176,7 @@ int f_pending=0, f_recursive=0, f_alsose 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 @@ static const struct cmdinfo cmdinfos[]= { "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 -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 |
| All times are GMT. The time now is 05:28 PM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.