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)
-- 
2.5.2


Reply via email to