summaryrefslogtreecommitdiffstats
path: root/firstaidkit
diff options
context:
space:
mode:
Diffstat (limited to 'firstaidkit')
-rwxr-xr-xfirstaidkit13
1 files changed, 11 insertions, 2 deletions
diff --git a/firstaidkit b/firstaidkit
index dda060e..fb5c6bd 100755
--- a/firstaidkit
+++ b/firstaidkit
@@ -16,8 +16,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-import sys
-import getopt
+import sys, getopt, os
from threading import Thread
from pyfirstaidkit import Tasker
from pyfirstaidkit import Config
@@ -64,8 +63,18 @@ if __name__=="__main__":
params, rest = getopt.getopt(sys.argv[1:], "ftc:r:vl:x:F:g:P:h",
["flow", "task", "config=", "root=", "verbose", "log=", "exclude=",
"flag=", "gui=", "plugin-path=", "print-config", "help"])
+
+ #
+ # Preliminary checks before we parse the options.
+ #
if len(params) == 0:
Flags.main_help = True
+ if os.geteuid() != 0:
+ # Might want to add the "I want to execute anyway" option.
+ print "\nYou must be root to execute firstaidkit.\n"
+ usage(sys.argv[0])
+ sys.exit(1)
+
for key,val in params:
if key in ("-t", "--task"):
Config.operation.mode = "task"