# HG changeset patch # User Vadim Misbakh-Soloviov # Date 1371197705 -25200 # Node ID 9fba74a28e0c4c09d5fa176903e2146227ecc8c7 # Parent 460070c84eaefddd68ef0cb4f650d3ae362957fa package{,c}path fixes for migration tools diff -r 460070c84eae -r 9fba74a28e0c tools/ejabberd2prosody.lua --- 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); diff -r 460070c84eae -r 9fba74a28e0c tools/ejabberdsql2prosody.lua --- 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; diff -r 460070c84eae -r 9fba74a28e0c tools/jabberd14sql2prosody.lua --- 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 = { }; diff -r 460070c84eae -r 9fba74a28e0c tools/openfire2prosody.lua --- 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"; diff -r 460070c84eae -r 9fba74a28e0c tools/xep227toprosody.lua --- 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";