From bd775f017f77043aac5b6290c9899f7daf23e172 Mon Sep 17 00:00:00 2001 From: TitanSnow Date: Mon, 22 May 2017 19:37:24 +0800 Subject: add module privilege to manage root privilege --- xmake/core/main.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'xmake/core/main.lua') diff --git a/xmake/core/main.lua b/xmake/core/main.lua index b4ca6afab..cda338294 100644 --- a/xmake/core/main.lua +++ b/xmake/core/main.lua @@ -32,6 +32,7 @@ local utils = require("base/utils") local option = require("base/option") local profiler = require("base/profiler") local deprecated = require("base/deprecated") +local privilege = require("base/privilege") local task = require("project/task") local history = require("project/history") @@ -143,12 +144,14 @@ function main.done() -- check run command as root if not option.get("root") then if os.isroot() then - utils.error([[Running xmake as root is extremely dangerous and no longer supported. + if not privilege.store() or os.isroot() then + utils.error([[Running xmake as root is extremely dangerous and no longer supported. As xmake does not drop privileges on installation you would be giving all build scripts full access to your system. Or you can add `--root` option to allow run as root temporarily. - ]]) - return -1 + ]]) + return -1 + end end end -- cgit v1.3.1