Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian dpkg (http://www.linux-archive.org/debian-dpkg/)
-   -   --force-confmiss and --overwrite-conffiles (http://www.linux-archive.org/debian-dpkg/394176-force-confmiss-overwrite-conffiles.html)

Daniel Bock 07-02-2010 02:46 PM

--force-confmiss and --overwrite-conffiles
 
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.bock@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-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 -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,
- _("
"
- "Configuration file `%s', does not exist on system.
"
- "Installing new config file as you requested.
"),
- 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>.
"

" --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_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-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4C2DFBB0.2090009@web.de">http://lists.debian.org/4C2DFBB0.2090009@web.de

Daniel Bock 07-02-2010 06:28 PM

--force-confmiss and --overwrite-conffiles
 
Hi,

sorry, I forgot the use of cfo_newconff, like in the old patch.

+ if (strcmp(currenthash, newdisthash) != 0 && f_overwriteconf
+ || !strcmp(currenthash, NONEXISTENTFLAG) && fc_conff_miss) {
+ if (useredited) {
+ what |= cfof_prompt;
+ fc_conff_new = 1;
+ } else
+ what = cfo_newconff;
+ }

regards,
Daniel Bock


--
To UNSUBSCRIBE, email to debian-dpkg-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4C2E2FD6.4030209@web.de">http://lists.debian.org/4C2E2FD6.4030209@web.de


All times are GMT. The time now is 09:36 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.