changeset 14060:6bf989c6fa3a

Merge 13.0->trunk
author Kim Alvefur <zash@zash.se>
date Sun, 08 Feb 2026 17:47:57 +0100
parents f20b3f0d892b (current diff) 2bdddcfad61d (diff)
children b0c31a5d8276
files
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tools/migration/prosody-migrator.lua	Sat Feb 07 19:12:27 2026 +0100
+++ b/tools/migration/prosody-migrator.lua	Sun Feb 08 17:47:57 2026 +0100
@@ -7,14 +7,21 @@
 
 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 
-local function is_relative(path)
-	local path_sep = package.config:sub(1,1);
-        return ((path_sep == "/" and path:sub(1,1) ~= "/")
-	or (path_sep == "\\" and (path:sub(1,1) ~= "/" and path:sub(2,3) ~= ":\\")))
+-- Check before first require, to preempt the probable failure
+if _VERSION < "Lua 5.2" then
+	io.stderr:write("Prosody is no longer compatible with Lua 5.1\n")
+	io.stderr:write("See https://prosody.im/doc/depends#lua for more information\n")
+	return os.exit(1);
 end
 
 -- Tell Lua where to find our libraries
 if CFG_SOURCEDIR then
+	-- Installed instance
+	local function is_relative(path)
+		local path_sep = package.config:sub(1,1);
+		return ((path_sep == "/" and path:sub(1,1) ~= "/")
+			or (path_sep == "\\" and (path:sub(1,1) ~= "/" and path:sub(2,3) ~= ":\\")))
+	end
 	local function filter_relative_paths(path)
 		if is_relative(path) then return ""; end
 	end
@@ -23,6 +30,11 @@
 	end
 	package.path = sanitise_paths(CFG_SOURCEDIR.."/?.lua;"..package.path);
 	package.cpath = sanitise_paths(CFG_SOURCEDIR.."/?.so;"..package.cpath);
+
+	require "prosody.loader";
+else
+	-- Not installed, e.g. running from a source checkout
+	require "loader";
 end
 
 -- Substitute ~ with path to home directory in data path