summaryrefslogtreecommitdiff
path: root/xmake/core/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-05-23 10:08:10 +0800
committerGitHub <[email protected]>2017-05-23 10:08:10 +0800
commitffa57872e4e1df66db1df8174ffcde4ff0dcd296 (patch)
treeefdfac36b53d06e8f18d12e4abe1d32de85cc67e /xmake/core/main.lua
parenta29b2d72f26bc88f64eb44cd14255dad68153e7d (diff)
parent2cb7a91bf266680266de51636ce6620cbecc9362 (diff)
Merge pull request #113 from TitanSnow/root
privilege manage (escalation & degradation) when running as root
Diffstat (limited to 'xmake/core/main.lua')
-rw-r--r--xmake/core/main.lua9
1 files changed, 6 insertions, 3 deletions
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