summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-12-25 09:02:20 +0000
committerZac Medico <zmedico@gentoo.org>2006-12-25 09:02:20 +0000
commit4e5abb4c8ff5448ae2bca4aa6b1b334f506fdf52 (patch)
tree94f1b2111c0292233b21d8e80e1f3064f48801ec
parentf19d539f821e32b5433cb9961e2ee3d961ed0eb0 (diff)
downloadportage-4e5abb4c8ff5448ae2bca4aa6b1b334f506fdf52.tar.gz
portage-4e5abb4c8ff5448ae2bca4aa6b1b334f506fdf52.tar.bz2
portage-4e5abb4c8ff5448ae2bca4aa6b1b334f506fdf52.zip
When the user has insufficient access privileges, specify whether superuser access or portage group access is required. When only portage group access is required but the user is not in the portage group, call portage_data.portage_group_warning() to remind people that the portage group is a system administration group.
svn path=/main/trunk/; revision=5389
-rwxr-xr-xbin/emerge28
1 files changed, 21 insertions, 7 deletions
diff --git a/bin/emerge b/bin/emerge
index 5f8bd5f61..1b07d77bf 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -4961,18 +4961,32 @@ 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 or \
- not ("--fetchonly" in myopts or \
+ need_superuser = not \
+ ("--fetchonly" in myopts or \
"--fetch-all-uri" in myopts or \
- myaction in ("metadata", "regen")):
+ myaction in ("metadata", "regen"))
+ if portage.secpass < 1 or \
+ need_superuser:
+ if need_superuser:
+ access_desc = "superuser"
+ else:
+ access_desc = "portage group"
+ # Always show portage_group_warning() when only portage group
+ # access is required but the user is not in the portage group.
+ from portage_data import portage_group_warning
if "--ask" in myopts:
myopts["--pretend"] = True
del myopts["--ask"]
- print "root access would be required..." + \
- " adding --pretend to options."
+ print ("%s access would be required... " + \
+ "adding --pretend to options.\n") % access_desc
+ if portage.secpass < 1 and not need_superuser:
+ portage_group_warning()
else:
- print "emerge: root access required."
- sys.exit(1)
+ sys.stderr.write(("emerge: %s access would be " + \
+ "required.\n\n") % access_desc)
+ if portage.secpass < 1 and not need_superuser:
+ portage_group_warning()
+ return 1
disable_emergelog = False
for x in ("--pretend", "--fetchonly", "--fetch-all-uri"):