This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=c498af86a5a6b4567f0ef882c8baac3b5b7ef30b

commit c498af86a5a6b4567f0ef882c8baac3b5b7ef30b
Author: Guillem Jover <[email protected]>
AuthorDate: Fri Sep 7 16:00:13 2018 +0200

    dpkg-statoverride: Add support for --force-* options
---
 debian/changelog          |  1 +
 man/dpkg-statoverride.man | 23 +++++++++++++++++++++++
 src/Makefile.am           |  1 +
 src/statcmd.c             |  9 +++++++++
 4 files changed, 34 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 6f3f4cec5..fdb018381 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,7 @@ dpkg (1.19.5) UNRELEASED; urgency=medium
   * dpkg: Print the current set of enabled force options on --force-help.
   * dpkg: Parse and set new DPKG_FORCE environment variable for subprocesses.
     Closes: #666147
+  * dpkg-statoverride: Add support for --force-* options.
   * Documentation:
     - start-stop-daemon(1): Document behavior of --pidfile security checks.
       Closes: #921557
diff --git a/man/dpkg-statoverride.man b/man/dpkg-statoverride.man
index 861d53bb7..c89f7eee7 100644
--- a/man/dpkg-statoverride.man
+++ b/man/dpkg-statoverride.man
@@ -64,6 +64,9 @@ to overrides which match the glob.
 .B \-\-help
 Show the usage message and exit.
 .TP
+.B \-\-force\-help
+Give help about the \fB\-\-force\-\fP\fIthing\fP options (since dpkg 1.19.5).
+.TP
 .B \-\-version
 Show the version and exit.
 .
@@ -84,6 +87,22 @@ Set the root directory to \fBdirectory\fP, which sets the 
installation
 directory to «\fIdirectory\fP» and the administrative
 directory to «\fIdirectory\fP\fB%ADMINDIR%\fP» (since dpkg 1.19.2).
 .TP
+.B \-\-force\-\fIthings\fP
+.TQ
+.BR \-\-no\-force\-\fIthings\fP ", " \-\-refuse\-\fIthings\fP
+Force or refuse (\fBno\-force\fP and \fBrefuse\fP mean the same thing)
+to do some things (since dpkg 1.19.5).
+\fIthings\fP is a comma separated list of things specified below.
+\fB\-\-force\-help\fP displays a message describing them.
+Things marked with (*) are forced by default.
+
+\fIWarning: These options are mostly intended to be used by experts only.
+Using them without fully understanding their effects may break your whole
+system.\fP
+
+\fBall\fP:
+Turns on (or off) all force options.
+.TP
 .B \-\-force
 Force an action, even if a sanity check would otherwise prohibit it.
 This is necessary to override an existing override.
@@ -120,6 +139,10 @@ specified, it will be used as the filesystem root directory
 If set and the \fB\-\-admindir\fP or \fB\-\-root\fP options have not been
 specified, it will be used as the \fBdpkg\fP data directory.
 .TP
+.B DPKG_FORCE
+If set and none of the \fB\-\-force\-\fP\fI...\fP options have been
+specified, it will be used as the force options to use (since dpkg 1.19.5).
+.TP
 .B DPKG_COLORS
 Sets the color mode (since dpkg 1.18.5).
 The currently accepted values are: \fBauto\fP (default), \fBalways\fP and
diff --git a/src/Makefile.am b/src/Makefile.am
index 93494db22..b1003f428 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -60,6 +60,7 @@ dpkg_query_SOURCES = \
        querycmd.c
 
 dpkg_statoverride_SOURCES = \
+       force.c force.h \
        selinux.c \
        statcmd.c
 
diff --git a/src/statcmd.c b/src/statcmd.c
index 4a6af8675..e3b73afec 100644
--- a/src/statcmd.c
+++ b/src/statcmd.c
@@ -40,12 +40,14 @@
 #include <dpkg/i18n.h>
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
+#include <dpkg/string.h>
 #include <dpkg/path.h>
 #include <dpkg/dir.h>
 #include <dpkg/glob.h>
 #include <dpkg/db-fsys.h>
 #include <dpkg/options.h>
 
+#include "force.h"
 #include "main.h"
 
 static const char printforhelp[] = N_(
@@ -88,6 +90,9 @@ usage(const struct cmdinfo *cip, const char *value)
 "  --root <directory>       set the directory of the root filesystem.\n"
 "  --update                 immediately update <path> permissions.\n"
 "  --force                  force an action even if a sanity check fails.\n"
+"  --force-...              override problems (see --force-help).\n"
+"  --no-force-...           stop when problems encountered.\n"
+"  --refuse-...             ditto.\n"
 "  --quiet                  quiet operation, minimal output.\n"
 "  --help                   show this help message.\n"
 "  --version                show the version.\n"
@@ -376,6 +381,9 @@ static const struct cmdinfo cmdinfos[] = {
        { "root",       0,   1,  NULL,         NULL,      set_root,     0 },
        { "quiet",      0,   0,  &opt_verbose, NULL,      NULL, 0       },
        { "force",      0,   0,  &opt_force,   NULL,      NULL, 1       },
+       { "force",      0,   2,  NULL,         NULL,      set_force_option, 1 },
+       { "no-force",   0,   2,  NULL,         NULL,      set_force_option, 0 },
+       { "refuse",     0,   2,  NULL,         NULL,      set_force_option, 0 },
        { "update",     0,   0,  &opt_update,  NULL,      NULL, 1       },
        { "help",       '?', 0,  NULL,         NULL,      usage         },
        { "version",    0,   0,  NULL,         NULL,      printversion  },
@@ -389,6 +397,7 @@ main(int argc, const char *const *argv)
 
        dpkg_locales_init(PACKAGE);
        dpkg_program_init("dpkg-statoverride");
+       set_force_default(0);
        dpkg_options_parse(&argv, cmdinfos, printforhelp);
 
        admindir = dpkg_db_set_dir(admindir);

-- 
Dpkg.Org's dpkg

Reply via email to