Comparison

prosodyctl @ 8098:ee1c81450345

prosodyctl: Remove --root from arg array
author Kim Alvefur <zash@zash.se>
date Wed, 19 Apr 2017 20:26:09 +0200
parent 8096:dd3191974f2a
child 8099:04eaaeb89a05
comparison
equal deleted inserted replaced
8097:e24263db3380 8098:ee1c81450345
139 local ok, pposix = pcall(require, "util.pposix"); 139 local ok, pposix = pcall(require, "util.pposix");
140 140
141 if ok and pposix then 141 if ok and pposix then
142 if pposix._VERSION ~= want_pposix_version then print(string.format("Unknown version (%s) of binary pposix module, expected %s", tostring(pposix._VERSION), want_pposix_version)); return; end 142 if pposix._VERSION ~= want_pposix_version then print(string.format("Unknown version (%s) of binary pposix module, expected %s", tostring(pposix._VERSION), want_pposix_version)); return; end
143 current_uid = pposix.getuid(); 143 current_uid = pposix.getuid();
144 if current_uid == 0 and config.get("*", "run_as_root") ~= true and arg[1] ~= "--root" then 144 local arg_root = arg[1] == "--root";
145 if arg_root then table.remove(arg, 1); end
146 if current_uid == 0 and config.get("*", "run_as_root") ~= true and not arg_root then
145 -- We haz root! 147 -- We haz root!
146 local desired_user = config.get("*", "prosody_user") or "prosody"; 148 local desired_user = config.get("*", "prosody_user") or "prosody";
147 local desired_group = config.get("*", "prosody_group") or desired_user; 149 local desired_group = config.get("*", "prosody_group") or desired_user;
148 local ok, err = pposix.setgid(desired_group); 150 local ok, err = pposix.setgid(desired_group);
149 if ok then 151 if ok then