Просмотр исходного кода

Add new dpkg --force-confask option

The option forces a conffile prompt when the conffile from the new
package does not differ from the previous one version.

Closes: #102609

Signed-off-by: Guillem Jover <guillem@debian.org>
Henning Makholm лет назад: 16
Родитель
Сommit
bd0ae9a42b
5 измененных файлов с 20 добавлено и 1 удалено
  1. 3 0
      debian/changelog
  2. 7 0
      man/dpkg.1
  3. 6 1
      src/configure.c
  4. 3 0
      src/main.c
  5. 1 0
      src/main.h

+ 3 - 0
debian/changelog

@@ -71,6 +71,9 @@ dpkg (1.15.8) UNRELEASED; urgency=low
   * Detect when another process has locked the database, and mention that
     problematic dpkg --audit results might be due to ongoing operations.
     Closes: #80252
+  * Add new dpkg --force-confask option that forces a conffile prompt when
+    the conffile from the new package does not differ from the previous one.
+    Thanks to Henning Makholm <henning@makholm.net>. Closes: #102609
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).

+ 7 - 0
man/dpkg.1

@@ -427,6 +427,13 @@ there is no default action it will stop to ask the user unless
 \fB\-\-force\-confnew\fP or \fB\-\-force\-confold\fP is also been given, in
 which case it will use that to decide the final action.
 
+\fBconfask\fP:
+If a conffile has been modified always offer to replace it with the
+version in the package, even if the version in the package did not
+change. If one of \fB\-\-force\-confnew\fP, \fB\-\-force\-confold\fP,
+or \fB\-\-force\-confdef\fP is also given, it will be used to decide
+the final action.
+
 \fBoverwrite\fP:
 Overwrite one package's file with another's file.
 

+ 6 - 1
src/configure.c

@@ -141,7 +141,12 @@ deferred_configure_conffile(struct pkginfo *pkg, struct conffile *conff)
 	} else {
 		useredited = strcmp(conff->hash, currenthash) != 0;
 		distedited = strcmp(conff->hash, newdisthash) != 0;
-		what = conffoptcells[useredited][distedited];
+
+		if (fc_conff_ask && useredited)
+			what = cfo_prompt_keep;
+		else
+			what = conffoptcells[useredited][distedited];
+
 		if (!strcmp(currenthash, NONEXISTENTFLAG))
 			what |= cfof_userrmd;
 	}

+ 3 - 0
src/main.c

@@ -183,6 +183,7 @@ int fc_removeessential=0, fc_conflicts=0, fc_depends=0, fc_dependsversion=0;
 int fc_breaks=0, fc_badpath=0, fc_overwritediverted=0, fc_architecture=0;
 int fc_nonroot=0, fc_overwritedir=0, fc_conff_new=0, fc_conff_miss=0;
 int fc_conff_old=0, fc_conff_def=0;
+int fc_conff_ask = 0;
 int fc_badverify = 0;
 
 int errabort = 50;
@@ -204,6 +205,7 @@ static const struct forceinfo {
   { "confold",             &fc_conff_old                },
   { "confdef",             &fc_conff_def                },
   { "confmiss",            &fc_conff_miss               },
+  { "confask",             &fc_conff_ask                },
   { "depends",             &fc_depends                  },
   { "depends-version",     &fc_dependsversion           },
   { "breaks",              &fc_breaks                   },
@@ -417,6 +419,7 @@ static void setforce(const struct cmdinfo *cip, const char *value) {
 "                         you will be prompted unless one of the confold or\n"
 "                         confnew options is also given\n"
 "  confmiss [!]           Always install missing config files\n"
+"  confask [!]            Offer to replace config files with no new versions\n"
 "  breaks [!]             Install even if it would break another package\n"
 "  conflicts [!]          Allow installation of conflicting packages\n"
 "  architecture [!]       Process even packages with wrong architecture\n"

+ 1 - 0
src/main.h

@@ -129,6 +129,7 @@ extern int fc_removeessential, fc_conflicts, fc_depends, fc_dependsversion;
 extern int fc_breaks, fc_badpath, fc_overwritediverted, fc_architecture;
 extern int fc_nonroot, fc_overwritedir, fc_conff_new, fc_conff_miss;
 extern int fc_conff_old, fc_conff_def;
+extern int fc_conff_ask;
 extern int fc_badverify;
 
 extern bool abort_processing;