commit: 24b8bcbb89103b77865a7b21cc94450d25c4bc7c
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 6 16:00:34 2015 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Oct 6 16:00:34 2015 +0000
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=24b8bcbb
main: delay root check until before we run
This way we can run things like --help and verify argument/config parsing
all as non-root. Only actual building requires root.
catalyst/main.py | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/catalyst/main.py b/catalyst/main.py
index 4e83414..604c6ab 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -168,13 +168,6 @@ def build_target(addlargs):
def main():
-
- if os.getuid() != 0:
- version()
- # catalyst cannot be run as a normal user due to chroots,
mounts, etc
- print "!!! catalyst: This script requires root privileges to
operate"
- sys.exit(2)
-
# we need some options in order to work correctly
if len(sys.argv) < 2:
usage()
@@ -342,6 +335,11 @@ def main():
if "target" not in addlargs:
raise CatalystError("Required value \"target\" not specified.")
+ if os.getuid() != 0:
+ # catalyst cannot be run as a normal user due to chroots,
mounts, etc
+ print "!!! catalyst: This script requires root privileges to
operate"
+ sys.exit(2)
+
# everything is setup, so the build is a go
try:
success = build_target(addlargs)