summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-11-15 04:09:50 +0000
committerZac Medico <zmedico@gentoo.org>2006-11-15 04:09:50 +0000
commita684fdcbe80bbbc934a7b702f1e34e09e951d6de (patch)
treec1fb8ffe10871d6fb698de59e23d2baed60711b7
parentd4c5158b8fd39fc1cdcba21e392d011a32a9d63b (diff)
downloadportage-a684fdcbe80bbbc934a7b702f1e34e09e951d6de.tar.gz
portage-a684fdcbe80bbbc934a7b702f1e34e09e951d6de.tar.bz2
portage-a684fdcbe80bbbc934a7b702f1e34e09e951d6de.zip
Automatically convert --ask to --pretend when the user doesn't have the privileges for --ask. Thanks to Daniel Barkalow <barkalow@iabervon.org> for the initial patch (submitted on gentoo-portage mailing list).
svn path=/main/trunk/; revision=5051
-rwxr-xr-xbin/emerge17
1 files 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"):