Comparison

util/prosodyctl.lua @ 11490:34d4e4a01ef8

util.prosodyctl: Install plugins for current Lua version Fixes that luarocks defaults to installing the rock for its own runtime version of Lua. This only works with luarocks 3.x, it does nothing on 2.x as currently available from Debian.
author Kim Alvefur <zash@zash.se>
date Tue, 16 Mar 2021 02:44:22 +0100
parent 11299:abe8cd8fad14
child 12785:123d74bf60e3
comparison
equal deleted inserted replaced
11489:37f49d0ad22c 11490:34d4e4a01ef8
219 219
220 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)
221 221
222 local function call_luarocks(operation, mod, server) 222 local function call_luarocks(operation, mod, server)
223 local dir = prosody.paths.installer; 223 local dir = prosody.paths.installer;
224 local ok, _, code = os.execute(render_cli("luarocks {op} --tree={dir} {server&--server={server}} {mod?}", { 224 local ok, _, code = os.execute(render_cli("luarocks --lua-version={luav} {op} --tree={dir} {server&--server={server}} {mod?}", {
225 dir = dir; op = operation; mod = mod; server = server; 225 dir = dir; op = operation; mod = mod; server = server; luav = _VERSION:match("5%.%d");
226 })); 226 }));
227 if type(ok) == "number" then code = ok; end 227 if type(ok) == "number" then code = ok; end
228 return code; 228 return code;
229 end 229 end
230 230