Mercurial > prosody-hg
changeset 14059:2bdddcfad61d 13.0
migrator: Apply loader fix here too
Copied from ./prosody
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 08 Feb 2026 17:44:17 +0100 |
| parents | 312542dd184d |
| children | 6bf989c6fa3a ef586363d90f |
| files | tools/migration/prosody-migrator.lua |
| diffstat | 1 files changed, 16 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/migration/prosody-migrator.lua Sun Feb 01 15:22:53 2026 +0100 +++ b/tools/migration/prosody-migrator.lua Sun Feb 08 17:44:17 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
