From: Wichert Akkerman Date: Thu, 14 Oct 1999 02:28:03 +0000 (+0000) Subject: Add --force options for handling changed conffiles X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11949951dbaa8b4fbae6dcbb44cd9a296aa88c5f;p=dpkg Add --force options for handling changed conffiles --- diff --git a/ChangeLog b/ChangeLog index 97c092dc..56110b15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ Thu Oct 14 04:16:25 CEST 1999 Wichert Akkerman * Reinstate patch to not read available-file with doing listfiles. * Don't forget to get the correct SHELL before showing a diff of conffiles! + * Merge a patch from Ben Collins to add a bunch of --force options + to handle changed conffiles Thu Oct 14 03:37:52 CEST 1999 Wichert Akkerman diff --git a/debian/changelog b/debian/changelog index aab981fc..daec71a6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,8 +16,10 @@ dpkg (1.4.1.15) unstable; urgency=low * dpkg-scanpackages: don't abort but only skip a package if we can't open it * Add HURD-support to start-stop-daemon + * Reinstate patch to not read available when doing --list-files + * Add a couple of --force options to handle changed conffiles - -- Wichert Akkerman Wed, 13 Oct 1999 21:52:17 +0200 + -- Wichert Akkerman Thu, 14 Oct 1999 04:20:56 +0200 dpkg (1.4.1.14) unstable; urgency=low diff --git a/main/configure.c b/main/configure.c index ab810447..512f01bc 100644 --- a/main/configure.c +++ b/main/configure.c @@ -185,6 +185,12 @@ void deferred_configure(struct pkginfo *pkg) { useredited= -1; distedited= -1; what= cfo_identical; + } else if (!strcmp(currenthash,NONEXISTENTFLAG) && fc_conff_miss) { + fprintf(stderr, _("\nConfiguration file `%s', does not exist on system.\n" + "Installing new config file as you request.\n"), conff->name); + what= cfo_newconff; + useredited= -1; + distedited= -1; } else if (!strcmp(conff->hash,NEWCONFFILEFLAG)) { if (!strcmp(currenthash,NONEXISTENTFLAG)) { what= cfo_newconff; @@ -205,6 +211,16 @@ void deferred_configure(struct pkginfo *pkg) { "deferred_configure `%s' (= `%s') useredited=%d distedited=%d what=%o", conff->name, cdr.buf, useredited, distedited, what); + /* When prompting we check for some of the force options. There are + * several cases in which these occur. + * - We have --force-confnew, in which we always use the new config file + * - We have --force-confold, in which we always use the old config file + * - We have --force-confdef, in which we always use the default action + * if there is one. Note, there are cases where we will still prompt + * - If we have --force-confdef and one of the others (new/old) then we + * always use the default where we can. If there is no default, then we + * use the new or old, depending on which --force-conf{old,new} was used. + */ if (what & cfof_prompt) { do { @@ -232,6 +248,28 @@ void deferred_configure(struct pkginfo *pkg) { } + if (!(fc_conff_def && (what & (cfof_install|cfof_keep)))) { + if (fc_conff_new) { + fprintf(stderr, _(" ==> Using new file as you requested.\n")); + cc = 'y'; + break; + } else if (fc_conff_old) { + fprintf(stderr, _(" ==> Using current old file as you requested.\n")); + cc = 'n'; + break; + } + } + + if (what & cfof_keep && fc_conff_def) { + fprintf(stderr, _(" ==> Keeping old config file as default.\n")); + cc = 'n'; + break; + } else if (what & cfof_install && fc_conff_def) { + fprintf(stderr, _(" ==> Using new config file as default.\n")); + cc = 'y'; + break; + } + fprintf(stderr, _(" What would you like to do about it ? Your options are:\n" " Y or I : install the package maintainer's version\n" diff --git a/main/main.c b/main/main.c index 24356d87..75714793 100644 --- a/main/main.c +++ b/main/main.c @@ -132,7 +132,8 @@ unsigned long f_debug=0; 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; int fc_autoselect=1, fc_badpath=0, fc_overwritediverted=0, fc_architecture=0; -int fc_nonroot=0, fc_overwritedir=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 errabort = 50; const char *admindir= ADMINDIR; @@ -149,6 +150,10 @@ static const struct forceinfo { { "remove-reinstreq", &fc_removereinstreq }, { "remove-essential", &fc_removeessential }, { "conflicts", &fc_conflicts }, + { "confnew", &fc_conff_new }, + { "confold", &fc_conff_old }, + { "confdef", &fc_conff_def }, + { "confmiss", &fc_conff_miss }, { "depends", &fc_depends }, { "depends-version", &fc_dependsversion }, { "auto-select", &fc_autoselect }, @@ -268,6 +273,13 @@ static void setforce(const struct cmdinfo *cip, const char *value) { overwrite-diverted Overwrite a diverted file with an undiverted version\n\ depends-version [!] Turn dependency version problems into warnings\n\ depends [!] Turn all dependency problems into warnings\n\ + confnew [!] Always use the new config files, don't prompt\n\ + confold [!] Always use the old config files, don't prompt\n\ + confdef [!] Use the default option for new config files if one\n\ + is available, don't prompt. If no default can be found,\n\ + you will be prompted unless one of the confold or\n\ + confnew options is also given\n\ + confmiss [!] Always install missing config files\n\ conflicts [!] Allow installation of conflicting packages\n\ architecture [!] Process even packages with wrong architecture\n\ overwrite-dir [!] Overwrite one package's directory with another's file\n\ diff --git a/main/main.h b/main/main.h index 23d2f0f5..6ee114df 100644 --- a/main/main.h +++ b/main/main.h @@ -83,7 +83,8 @@ extern unsigned long f_debug; 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_autoselect, fc_badpath, fc_overwritediverted, fc_architecture; -extern int fc_nonroot, fc_overwritedir; +extern int fc_nonroot, fc_overwritedir, fc_conff_new, fc_conff_miss; +extern int fc_conff_old, fc_conff_def; extern int errabort; extern const char *admindir; @@ -165,6 +166,8 @@ void cu_closefd(int argc, void **argv); int ignore_depends(struct pkginfo *pkg); int force_depends(struct deppossi *possi); +int force_conff_new(struct deppossi *possi); +int force_conff_miss(struct deppossi *possi); int force_conflicts(struct deppossi *possi); void ensure_package_clientdata(struct pkginfo *pkg); const char *pkgadminfile(struct pkginfo *pkg, const char *whichfile);