pacman: add --confirm option
--confirm cancels the effect of a previous --noconfirm. This makes it easier for scripts to default to --noconfirm but allow users to override it. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
7ddc967d7c
commit
01beca5df7
@ -177,6 +177,9 @@ Options
|
|||||||
Bypass any and all ``Are you sure?'' messages. It's not a good idea to do
|
Bypass any and all ``Are you sure?'' messages. It's not a good idea to do
|
||||||
this unless you want to run pacman from a script.
|
this unless you want to run pacman from a script.
|
||||||
|
|
||||||
|
*\--confirm*::
|
||||||
|
Cancels the effects of a previous '\--noconfirm'.
|
||||||
|
|
||||||
|
|
||||||
Transaction Options (apply to '-S', '-R' and '-U')
|
Transaction Options (apply to '-S', '-R' and '-U')
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
@ -131,6 +131,7 @@ enum {
|
|||||||
enum {
|
enum {
|
||||||
OP_LONG_FLAG_MIN = 1000,
|
OP_LONG_FLAG_MIN = 1000,
|
||||||
OP_NOCONFIRM,
|
OP_NOCONFIRM,
|
||||||
|
OP_CONFIRM,
|
||||||
OP_CONFIG,
|
OP_CONFIG,
|
||||||
OP_IGNORE,
|
OP_IGNORE,
|
||||||
OP_DEBUG,
|
OP_DEBUG,
|
||||||
|
@ -205,6 +205,7 @@ static void usage(int op, const char * const myname)
|
|||||||
addlist(_(" --gpgdir <path> set an alternate home directory for GnuPG\n"));
|
addlist(_(" --gpgdir <path> set an alternate home directory for GnuPG\n"));
|
||||||
addlist(_(" --logfile <path> set an alternate log file\n"));
|
addlist(_(" --logfile <path> set an alternate log file\n"));
|
||||||
addlist(_(" --noconfirm do not ask for any confirmation\n"));
|
addlist(_(" --noconfirm do not ask for any confirmation\n"));
|
||||||
|
addlist(_(" --confirm always ask for confirmation\n"));
|
||||||
}
|
}
|
||||||
list = alpm_list_msort(list, alpm_list_count(list), options_cmp);
|
list = alpm_list_msort(list, alpm_list_count(list), options_cmp);
|
||||||
for(i = list; i; i = alpm_list_next(i)) {
|
for(i = list; i; i = alpm_list_next(i)) {
|
||||||
@ -456,6 +457,9 @@ static int parsearg_global(int opt)
|
|||||||
case OP_NOCONFIRM:
|
case OP_NOCONFIRM:
|
||||||
config->noconfirm = 1;
|
config->noconfirm = 1;
|
||||||
break;
|
break;
|
||||||
|
case OP_CONFIRM:
|
||||||
|
config->noconfirm = 0;
|
||||||
|
break;
|
||||||
case OP_DBPATH:
|
case OP_DBPATH:
|
||||||
case 'b':
|
case 'b':
|
||||||
free(config->dbpath);
|
free(config->dbpath);
|
||||||
@ -858,6 +862,7 @@ static int parseargs(int argc, char *argv[])
|
|||||||
{"downloadonly", no_argument, 0, OP_DOWNLOADONLY},
|
{"downloadonly", no_argument, 0, OP_DOWNLOADONLY},
|
||||||
{"refresh", no_argument, 0, OP_REFRESH},
|
{"refresh", no_argument, 0, OP_REFRESH},
|
||||||
{"noconfirm", no_argument, 0, OP_NOCONFIRM},
|
{"noconfirm", no_argument, 0, OP_NOCONFIRM},
|
||||||
|
{"confirm", no_argument, 0, OP_CONFIRM},
|
||||||
{"config", required_argument, 0, OP_CONFIG},
|
{"config", required_argument, 0, OP_CONFIG},
|
||||||
{"ignore", required_argument, 0, OP_IGNORE},
|
{"ignore", required_argument, 0, OP_IGNORE},
|
||||||
{"assume-installed", required_argument, 0, OP_ASSUMEINSTALLED},
|
{"assume-installed", required_argument, 0, OP_ASSUMEINSTALLED},
|
||||||
|
@ -234,13 +234,13 @@ def run(self, pacman):
|
|||||||
"--log-file=%s" % os.path.join(self.root, "var/log/valgrind"),
|
"--log-file=%s" % os.path.join(self.root, "var/log/valgrind"),
|
||||||
"--suppressions=%s" % suppfile])
|
"--suppressions=%s" % suppfile])
|
||||||
self.addrule("FILE_EMPTY=var/log/valgrind")
|
self.addrule("FILE_EMPTY=var/log/valgrind")
|
||||||
cmd.extend([pacman["bin"],
|
cmd.extend([pacman["bin"], "--noconfirm",
|
||||||
"--config", os.path.join(self.root, util.PACCONF),
|
"--config", os.path.join(self.root, util.PACCONF),
|
||||||
"--root", self.root,
|
"--root", self.root,
|
||||||
"--dbpath", os.path.join(self.root, util.PM_DBPATH),
|
"--dbpath", os.path.join(self.root, util.PM_DBPATH),
|
||||||
"--cachedir", os.path.join(self.root, util.PM_CACHEDIR)])
|
"--cachedir", os.path.join(self.root, util.PM_CACHEDIR)])
|
||||||
if not pacman["manual-confirm"]:
|
if pacman["manual-confirm"]:
|
||||||
cmd.append("--noconfirm")
|
cmd.append("--confirm")
|
||||||
if pacman["debug"]:
|
if pacman["debug"]:
|
||||||
cmd.append("--debug=%s" % pacman["debug"])
|
cmd.append("--debug=%s" % pacman["debug"])
|
||||||
cmd.extend(shlex.split(self.args))
|
cmd.extend(shlex.split(self.args))
|
||||||
|
Loading…
Reference in New Issue
Block a user