From a684fdcbe80bbbc934a7b702f1e34e09e951d6de Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 15 Nov 2006 04:09:50 +0000 Subject: [PATCH] Automatically convert --ask to --pretend when the user doesn't have the privileges for --ask. Thanks to Daniel Barkalow for the initial patch (submitted on gentoo-portage mailing list). svn path=/main/trunk/; revision=5051 --- bin/emerge | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/bin/emerge b/bin/emerge index f2c523dd1..d51c9c609 100755 --- a/bin/emerge +++ b/bin/emerge @@ -4571,15 +4571,18 @@ def emerge_main(): # We've already allowed "--version" and "--help" above. if "--pretend" not in myopts and \ myaction not in ("search","info"): - if portage.secpass >= 1: - if "--fetchonly" not in myopts and \ - "--fetch-all-uri" not in myopts and \ - myaction not in ("metadata", "regen"): + if portage.secpass < 1 or \ + not ("--fetchonly" in myopts or \ + "--fetch-all-uri" in myopts or \ + myaction in ("metadata", "regen")): + if "--ask" in myopts: + myopts["--pretend"] = True + del myopts["--ask"] + print "root access would be required..." + \ + " adding --pretend to options." + else: print "emerge: root access required." sys.exit(1) - else: - print "emerge: root access required." - sys.exit(1) disable_emergelog = False for x in ("--pretend", "--fetchonly", "--fetch-all-uri"): -- 2.26.2