aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ejabberd2prosody.lua2
-rw-r--r--tools/migration/migrator/prosody_files.lua1
-rw-r--r--tools/migration/prosody-migrator.lua24
3 files changed, 12 insertions, 15 deletions
diff --git a/tools/ejabberd2prosody.lua b/tools/ejabberd2prosody.lua
index 545bd922..656f0824 100755
--- a/tools/ejabberd2prosody.lua
+++ b/tools/ejabberd2prosody.lua
@@ -15,7 +15,7 @@ if arg[0]:match("^./") then
package.path = package.path .. ";"..arg[0]:gsub("/ejabberd2prosody.lua$", "/?.lua");
end
-require "erlparse";
+local erlparse = require "erlparse";
prosody = {};
diff --git a/tools/migration/migrator/prosody_files.lua b/tools/migration/migrator/prosody_files.lua
index be0c49f8..4462fb3e 100644
--- a/tools/migration/migrator/prosody_files.lua
+++ b/tools/migration/migrator/prosody_files.lua
@@ -7,7 +7,6 @@ local char = string.char;
local coroutine = coroutine;
local lfs = require "lfs";
local loadfile = loadfile;
-local setfenv = setfenv;
local pcall = pcall;
local mtools = require "migrator.mtools";
local next = next;
diff --git a/tools/migration/prosody-migrator.lua b/tools/migration/prosody-migrator.lua
index 2a8bf1c3..7c933b88 100644
--- a/tools/migration/prosody-migrator.lua
+++ b/tools/migration/prosody-migrator.lua
@@ -30,16 +30,22 @@ for i = 1, #arg do
end
table.remove(arg, handled_opts);
+if CFG_SOURCEDIR then
+ package.path = CFG_SOURCEDIR.."/?.lua;"..package.path;
+ package.cpath = CFG_SOURCEDIR.."/?.so;"..package.cpath;
+else
+ package.path = "../../?.lua;"..package.path
+ package.cpath = "../../?.so;"..package.cpath
+end
+
+local envloadfile = require "util.envload".envloadfile;
+
-- Load config file
local function loadfilein(file, env)
if loadin then
return loadin(env, io.open(file):read("*a"));
else
- local chunk, err = loadfile(file);
- if chunk then
- setfenv(chunk, env);
- end
- return chunk, err;
+ return envloadfile(file, env);
end
end
@@ -59,14 +65,6 @@ end
config_chunk();
-if CFG_SOURCEDIR then
- package.path = CFG_SOURCEDIR.."/?.lua;"..package.path;
- package.cpath = CFG_SOURCEDIR.."/?.so;"..package.cpath;
-elseif not package.loaded["util.json"] then
- package.path = "../../?.lua;"..package.path
- package.cpath = "../../?.so;"..package.cpath
-end
-
local have_err;
if #arg > 0 and #arg ~= 2 then
have_err = true;