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