From: Zac Medico Date: Wed, 15 Nov 2006 04:09:50 +0000 (-0000) Subject: Automatically convert --ask to --pretend when the user doesn't have the privileges... X-Git-Tag: v2.1.2~462 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a684fdcbe80bbbc934a7b702f1e34e09e951d6de;p=portage.git 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 --- 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"):