From e52796be1f215669255fd0ffd89207cc85fb0a6a Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Thu, 19 May 2016 01:51:20 +0200 Subject: [PATCH] [fix] exit if not runned as root instead of raising a obscur exception --- bin/yunohost | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/yunohost b/bin/yunohost index 0f2385c10..9290bc651 100755 --- a/bin/yunohost +++ b/bin/yunohost @@ -185,6 +185,10 @@ def _retrieve_namespaces(): # Main action ---------------------------------------------------------- if __name__ == '__main__': + if os.geteuid() != 0: + # since moulinette isn't initialized, we can't use m18n here + sys.stderr.write("\033[1;31mError:\033[0m yunohost command must be runed as root or with sudo.\n") + sys.exit(1) parser, opts, args = _parse_cli_args() _init_moulinette(opts.debug, opts.verbose, opts.quiet)