util.prosodyctl: Install plugins for current Lua version
authorKim Alvefur <zash@zash.se>
Tue, 16 Mar 2021 02:44:22 +0100
changeset 11494 34d4e4a01ef8
parent 11493 37f49d0ad22c
child 11495 c3fb802f9e45
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.
util/prosodyctl.lua
--- a/util/prosodyctl.lua	Fri Mar 26 13:03:22 2021 +0100
+++ b/util/prosodyctl.lua	Tue Mar 16 02:44:22 2021 +0100
@@ -221,8 +221,8 @@
 
 local function call_luarocks(operation, mod, server)
 	local dir = prosody.paths.installer;
-	local ok, _, code = os.execute(render_cli("luarocks {op} --tree={dir} {server&--server={server}} {mod?}", {
-				dir = dir; op = operation; mod = mod; server = server;
+	local ok, _, code = os.execute(render_cli("luarocks --lua-version={luav} {op} --tree={dir} {server&--server={server}} {mod?}", {
+				dir = dir; op = operation; mod = mod; server = server; luav = _VERSION:match("5%.%d");
 		}));
 	if type(ok) == "number" then code = ok; end
 	return code;