Software /
code /
prosody
Changeset
5696:9fba74a28e0c
package{,c}path fixes for migration tools
author | Vadim Misbakh-Soloviov <mva@mva.name> |
---|---|
date | Fri, 14 Jun 2013 15:15:05 +0700 |
parents | 5695:460070c84eae |
children | 5697:956df0f1cb70 |
files | tools/ejabberd2prosody.lua tools/ejabberdsql2prosody.lua tools/jabberd14sql2prosody.lua tools/openfire2prosody.lua tools/xep227toprosody.lua |
diffstat | 5 files changed, 34 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/ejabberd2prosody.lua Thu Jun 13 23:24:36 2013 +0100 +++ b/tools/ejabberd2prosody.lua Fri Jun 14 15:15:05 2013 +0700 @@ -11,8 +11,10 @@ package.path = package.path ..";../?.lua"; -if arg[0]:match("[/\\]") then - package.path = package.path .. ";"..arg[0]:gsub("[^/\\]*$", "?.lua"); +local my_name = arg[0]; +if my_name:match("[/\\]") then + package.path = package.path..";"..my_name:gsub("[^/\\]+$", "../?.lua"); + package.cpath = package.cpath..";"..my_name:gsub("[^/\\]+$", "../?.so"); end local erlparse = require "erlparse"; @@ -229,10 +231,10 @@ if not arg or help:find(arg, 1, true) then print([[ejabberd db dump importer for Prosody - Usage: ejabberd2prosody.lua filename.txt + Usage: ]]..my_name..[[ filename.txt The file can be generated from ejabberd using: - sudo ./bin/ejabberdctl dump filename.txt + sudo ejabberdctl dump filename.txt Note: The path of ejabberdctl depends on your ejabberd installation, and ejabberd needs to be running for ejabberdctl to work.]]); os.exit(1);
--- a/tools/ejabberdsql2prosody.lua Thu Jun 13 23:24:36 2013 +0100 +++ b/tools/ejabberdsql2prosody.lua Fri Jun 14 15:15:05 2013 +0700 @@ -10,6 +10,14 @@ prosody = {}; package.path = package.path ..";../?.lua"; + +local my_name = arg[0]; +if my_name:match("[/\\]") then + package.path = package.path..";"..my_name:gsub("[^/\\]+$", "../?.lua"); + package.cpath = package.cpath..";"..my_name:gsub("[^/\\]+$", "../?.so"); +end + + local serialize = require "util.serialization".serialize; local st = require "util.stanza"; local parse_xml = require "util.xml".parse;
--- a/tools/jabberd14sql2prosody.lua Thu Jun 13 23:24:36 2013 +0100 +++ b/tools/jabberd14sql2prosody.lua Fri Jun 14 15:15:05 2013 +0700 @@ -428,7 +428,14 @@ end -- import modules -package.path = [[C:\Documents and Settings\Waqas\Desktop\mercurial\prosody-hg\?.lua;]]..package.path; +package.path = package.path.."..\?.lua;"; + +local my_name = arg[0]; +if my_name:match("[/\\]") then + package.path = package.path..";"..my_name:gsub("[^/\\]+$", "../?.lua"); + package.cpath = package.cpath..";"..my_name:gsub("[^/\\]+$", "../?.so"); +end + -- ugly workaround for getting datamanager to work outside of prosody :( prosody = { };
--- a/tools/openfire2prosody.lua Thu Jun 13 23:24:36 2013 +0100 +++ b/tools/openfire2prosody.lua Fri Jun 14 15:15:05 2013 +0700 @@ -9,6 +9,12 @@ package.path = package.path..";../?.lua"; package.cpath = package.cpath..";../?.so"; -- needed for util.pposix used in datamanager +local my_name = arg[0]; +if my_name:match("[/\\]") then + package.path = package.path..";"..my_name:gsub("[^/\\]+$", "../?.lua"); + package.cpath = package.cpath..";"..my_name:gsub("[^/\\]+$", "../?.so"); +end + -- ugly workaround for getting datamanager to work outside of prosody :( prosody = { }; prosody.platform = "unknown";
--- a/tools/xep227toprosody.lua Thu Jun 13 23:24:36 2013 +0100 +++ b/tools/xep227toprosody.lua Fri Jun 14 15:15:05 2013 +0700 @@ -25,6 +25,12 @@ package.path = package.path..";../?.lua"; package.cpath = package.cpath..";../?.so"; -- needed for util.pposix used in datamanager +local my_name = arg[0]; +if my_name:match("[/\\]") then + package.path = package.path..";"..my_name:gsub("[^/\\]+$", "../?.lua"); + package.cpath = package.cpath..";"..my_name:gsub("[^/\\]+$", "../?.so"); +end + -- ugly workaround for getting datamanager to work outside of prosody :( prosody = { }; prosody.platform = "unknown";