diff options
| author | ruki <[email protected]> | 2017-03-28 21:58:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-03-28 21:58:52 +0800 |
| commit | 8e0c711fb2ea0fb3a54b9f2b41d1907fc4be8b02 (patch) | |
| tree | c9f7fdc3dc1ea9155e8fd01e57b66c71f0abaf72 /xmake/actions/install/main.lua | |
| parent | 6672a212d0ea74c3d6c6425b58b4fbb1dea7999c (diff) | |
add sudo interface
Diffstat (limited to 'xmake/actions/install/main.lua')
| -rw-r--r-- | xmake/actions/install/main.lua | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/xmake/actions/install/main.lua b/xmake/actions/install/main.lua index 5d4e33179..4b47ff7f0 100644 --- a/xmake/actions/install/main.lua +++ b/xmake/actions/install/main.lua @@ -40,6 +40,7 @@ function main() try { function () + -- install target install.install(targetname) @@ -52,25 +53,11 @@ function main() -- failed or not permission? request administrator permission and install it again function (errors) - -- init argv - local argv = {"xmake", "lua"} - for _, name in ipairs({"file", "project", "backtrace", "verbose", "quiet"}) do - local value = option.get(name) - if type(value) == "string" then - table.insert(argv, "--" .. name .. "=" .. value) - elseif value then - table.insert(argv, "--" .. name) - end - end - table.insert(argv, path.join(os.scriptdir(), "install_admin.lua")) - table.insert(argv, targetname) - table.insert(argv, option.get("installdir")) - -- show tips cprint("${bright red}error: ${default red}installation failed, may permission denied!") -- continue to install with administrator permission? - if os.sudo() then + if os.feature("sudo") then -- show tips cprint("${bright yellow}note: ${default yellow}try continue to install with administrator permission again?") @@ -81,7 +68,7 @@ function main() if io.read() == 'y' then -- install target with administrator permission - os.runv(os.sudo(), argv) + os.sudol(os.runv, path.join(os.scriptdir(), "install_admin.lua"), {targetname, option.get("installdir")}) -- trace cprint("${bright}install ok!${clear}${ok_hand}") |
