2022-11-14 15:54:08 +00:00
|
|
|
#!/usr/bin/env lua
|
|
|
|
|
|
|
|
-- This file is a launcher, that takes the first argument to choose what to launch.
|
|
|
|
|
|
|
|
local what = table.remove(arg, 1);
|
2023-05-19 10:52:52 +00:00
|
|
|
if what == 'debug' then
|
|
|
|
-- Special debug mode. Should not be used in production.
|
2023-05-21 09:23:57 +00:00
|
|
|
-- Note: i did not achieve to make it properly work (Prosody uses coroutines, and i did not manage to use breakpoints)
|
2023-05-19 10:52:52 +00:00
|
|
|
print('Activating MobDebug...');
|
|
|
|
mobdebug_path = table.remove(arg, 1);
|
|
|
|
mobdebug_host = table.remove(arg, 1);
|
|
|
|
mobdebug_port = table.remove(arg, 1);
|
|
|
|
local lua_path_sep = package.config:sub(3,3);
|
|
|
|
local dir_sep = package.config:sub(1,1);
|
|
|
|
package.path = package.path..lua_path_sep..mobdebug_path..dir_sep.."?.lua";
|
2023-05-21 09:23:57 +00:00
|
|
|
require "mobdebug".checkcount = 1;
|
2023-05-19 10:52:52 +00:00
|
|
|
require "mobdebug".start(mobdebug_host, mobdebug_port);
|
2023-05-19 13:50:32 +00:00
|
|
|
require "mobdebug".coro();
|
2023-05-19 10:52:52 +00:00
|
|
|
what = table.remove(arg, 1);
|
|
|
|
end
|
|
|
|
|
2022-11-14 15:54:08 +00:00
|
|
|
if what == 'prosody' then
|
|
|
|
dofile('/usr/bin/prosody');
|
|
|
|
elseif what == 'prosodyctl' then
|
|
|
|
dofile('/usr/bin/prosodyctl');
|
|
|
|
else
|
|
|
|
print("Unknown command: "..what);
|
|
|
|
os.exit(1);
|
|
|
|
end
|