diff options
-rwxr-xr-x | bin/emerge | 28 |
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"): |