From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-838769-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 0769313888F for <garchives@archives.gentoo.org>; Tue, 6 Oct 2015 17:03:16 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 88699E0869; Tue, 6 Oct 2015 17:03:15 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 31E03E0869 for <gentoo-commits@lists.gentoo.org>; Tue, 6 Oct 2015 17:03:15 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 328EF34086E for <gentoo-commits@lists.gentoo.org>; Tue, 6 Oct 2015 17:03:13 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id DB599AE1 for <gentoo-commits@lists.gentoo.org>; Tue, 6 Oct 2015 17:03:11 +0000 (UTC) From: "Mike Frysinger" <vapier@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" <vapier@gentoo.org> Message-ID: <1444147234.24b8bcbb89103b77865a7b21cc94450d25c4bc7c.vapier@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/main.py X-VCS-Directories: catalyst/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 24b8bcbb89103b77865a7b21cc94450d25c4bc7c X-VCS-Branch: master Date: Tue, 6 Oct 2015 17:03:11 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 5b3f6a8d-3bc9-420a-a89f-ab27ae1eac2b X-Archives-Hash: 8b2024db9f15d06fe8d809d7f29e85b5 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)