aboutsummaryrefslogtreecommitdiffstats
path: root/prosodyctl
diff options
context:
space:
mode:
Diffstat (limited to 'prosodyctl')
-rwxr-xr-xprosodyctl49
1 files changed, 30 insertions, 19 deletions
diff --git a/prosodyctl b/prosodyctl
index e769ed5d..722e8ff2 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -44,22 +44,33 @@ end
-----------
-local startup = require "util.startup";
+-- 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
+
+if not pcall(require, "prosody.loader") then
+ pcall(require, "loader");
+end
+
+local startup = require "prosody.util.startup";
startup.prosodyctl();
-----------
-local configmanager = require "core.configmanager";
-local modulemanager = require "core.modulemanager"
-local prosodyctl = require "util.prosodyctl"
+local configmanager = require "prosody.core.configmanager";
+local modulemanager = require "prosody.core.modulemanager"
+local prosodyctl = require "prosody.util.prosodyctl"
local socket = require "socket"
-local dependencies = require "util.dependencies";
+local dependencies = require "prosody.util.dependencies";
local lfs = dependencies.softreq "lfs";
-----------------------
-local parse_args = require "util.argparse".parse;
-local human_io = require "util.human.io";
+local parse_args = require "prosody.util.argparse".parse;
+local human_io = require "prosody.util.human.io";
local show_message, show_warning = prosodyctl.show_message, prosodyctl.show_warning;
local show_usage = prosodyctl.show_usage;
@@ -67,7 +78,7 @@ local read_password = human_io.read_password;
local call_luarocks = prosodyctl.call_luarocks;
local error_messages = prosodyctl.error_messages;
-local jid_split = require "util.jid".prepped_split;
+local jid_split = require "prosody.util.jid".prepped_split;
local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2;
-----------------------
@@ -427,8 +438,8 @@ function commands.about(arg)
end
local pwd = ".";
- local sorted_pairs = require "util.iterators".sorted_pairs;
- local hg = require"util.mercurial";
+ local sorted_pairs = require "prosody.util.iterators".sorted_pairs;
+ local hg = require"prosody.util.mercurial";
local relpath = configmanager.resolve_relative_path;
print("Prosody "..(prosody.version or "(unknown version)"));
@@ -450,7 +461,7 @@ function commands.about(arg)
.."\n ";
end)));
print("");
- local have_pposix, pposix = pcall(require, "util.pposix");
+ local have_pposix, pposix = pcall(require, "prosody.util.pposix");
if have_pposix and pposix.uname then
print("# Operating system");
local uname, err = pposix.uname();
@@ -483,7 +494,7 @@ function commands.about(arg)
print("");
print("# Network");
print("");
- print("Backend: "..require "net.server".get_backend());
+ print("Backend: "..require "prosody.net.server".get_backend());
print("");
print("# Lua module versions");
local module_versions, longest_name = {}, 8;
@@ -505,7 +516,7 @@ function commands.about(arg)
}
local lunbound = dependencies.softreq"lunbound";
local lxp = dependencies.softreq"lxp";
- local hashes = dependencies.softreq"util.hashes";
+ local hashes = dependencies.softreq"prosody.util.hashes";
for name, module in pairs(package.loaded) do
local version_field = alternate_version_fields[name] or "_VERSION";
if type(module) == "table" and rawget(module, version_field)
@@ -538,7 +549,7 @@ function commands.about(arg)
end
print("");
print("# library versions");
- if require "net.server".event_base then
+ if require "prosody.net.server".event_base then
library_versions["libevent"] = require"luaevent".core.libevent_version();
end
for name, version in sorted_pairs(library_versions) do
@@ -573,7 +584,7 @@ function commands.reload(arg)
end
-- ejabberdctl compatibility
-local unpack = table.unpack or unpack; -- luacheck: ignore 113
+local unpack = table.unpack;
function commands.register(arg)
local user, host, password = unpack(arg);
@@ -628,8 +639,8 @@ end
---------------------
-local async = require "util.async";
-local server = require "net.server";
+local async = require "prosody.util.async";
+local server = require "prosody.net.server";
local watchers = {
error = function (_, err)
error(err);
@@ -675,7 +686,7 @@ local command_runner = async.runner(function ()
end
if command and not commands[command] then
- local ok, command_module = pcall(require, "util.prosodyctl."..command);
+ local ok, command_module = pcall(require, "prosody.util.prosodyctl."..command);
if ok and command_module[command] then
commands[command] = command_module[command];
end
@@ -692,7 +703,7 @@ local command_runner = async.runner(function ()
print("");
print("Where COMMAND may be one of:");
- local hidden_commands = require "util.set".new{ "register", "unregister" };
+ local hidden_commands = require "prosody.util.set".new{ "register", "unregister" };
local commands_order = {
"Process management:",
"start"; "stop"; "restart"; "reload"; "status";