migrator: Customise startup sequence to fix #1673 (Thanks acidsys)
Diverge from util.startup.prosodyctl() in order to skip unneeded
behavior, such as loading the *Prosody* config file, which we do not
need here, based on the `--config` flag which should point at the
migrator config file instead.
Notably removed:
* read_config() since this loads the Prosody config
* check_unwriteable() which checks logfiles specified in the Prosody config, so not relevant
* make_dummy_hosts() but the migrator sets up its own hosts during migration
--- a/tools/migration/prosody-migrator.lua Tue Jul 27 00:13:18 2021 +0200
+++ b/tools/migration/prosody-migrator.lua Thu Jul 29 13:47:26 2021 +0200
@@ -35,8 +35,25 @@
local default_config = (CFG_CONFIGDIR or ".").."/migrator.cfg.lua";
local startup = require "util.startup";
-startup.prosodyctl();
--- TODO startup.migrator ?
+do
+ startup.parse_args();
+ startup.init_global_state();
+ prosody.process_type = "migrator";
+ startup.force_console_logging();
+ startup.init_logging();
+ startup.init_gc();
+ startup.init_errors();
+ startup.setup_plugindir();
+ startup.setup_plugin_install_path();
+ startup.setup_datadir();
+ startup.chdir();
+ startup.read_version();
+ startup.switch_user();
+ startup.check_dependencies();
+ startup.log_startup_warnings();
+ startup.load_libraries();
+ startup.init_http_client();
+end
-- Command-line parsing
local options = {};