Comparison

util/prosodyctl.lua @ 11290:7919ecdc4a72

util.prosodyctl: Use installer path prepared by util.startup
author Kim Alvefur <zash@zash.se>
date Thu, 21 Jan 2021 18:39:18 +0100
parent 11136:d0d3e25b7300
child 11291:9a98464a35e4
comparison
equal deleted inserted replaced
11289:c6965f3c321c 11290:7919ecdc4a72
215 215
216 signal.kill(pid, signal.SIGHUP); 216 signal.kill(pid, signal.SIGHUP);
217 return true; 217 return true;
218 end 218 end
219 219
220 local function get_path_custom_plugins(plugin_paths)
221 -- I'm considering that the custom plugins' path is the first one at prosody.paths.plugins
222 -- luacheck: ignore 512
223 for path in plugin_paths:gmatch("[^;]+") do
224 return path;
225 end
226 end
227
228 local render_cli = interpolation.new("%b{}", function (s) return "'"..s:gsub("'","'\\''").."'" end) 220 local render_cli = interpolation.new("%b{}", function (s) return "'"..s:gsub("'","'\\''").."'" end)
229 221
230 local function call_luarocks(operation, mod, server) 222 local function call_luarocks(operation, mod, server)
231 local dir = get_path_custom_plugins(prosody.paths.plugins); 223 local dir = prosody.paths.installer;
232 if operation == "install" then 224 if operation == "install" then
233 show_message("Installing %s at %s", mod, dir); 225 show_message("Installing %s at %s", mod, dir);
234 elseif operation == "remove" then 226 elseif operation == "remove" then
235 show_message("Removing %s from %s", mod, dir); 227 show_message("Removing %s from %s", mod, dir);
236 end 228 end
254 getpid = getpid; 246 getpid = getpid;
255 isrunning = isrunning; 247 isrunning = isrunning;
256 start = start; 248 start = start;
257 stop = stop; 249 stop = stop;
258 reload = reload; 250 reload = reload;
259 get_path_custom_plugins = get_path_custom_plugins;
260 call_luarocks = call_luarocks; 251 call_luarocks = call_luarocks;
261 error_messages = error_messages; 252 error_messages = error_messages;
262 }; 253 };