Download raw body.
net/prosody: install prosody-migrator
On Tue, Oct 22, 2024 at 03:53:42PM +0000, Lucas Gabriel Vuotto wrote:
> Hello ports@,
>
> somebody in the Prosody MUC asked about using prosody-migrator. It's a
> tool included in Prosody's source that allows for converting between
> storage backends and replicating data. I gave it a quick test and seems
> to work, so here's a patch for it.
Updated patch. prosody-migrator was trying to drop priviledges to
prosody, but our user is _prosody. Fix that at source leve by changing
the default user when a config isn't present.
In the meantime, the person asking for it was able successfully test it.
OK?
diff refs/heads/master 14af241134759373ed539eccd963475cd7f5dcc4
commit - 9cea45611ab91c8e308e4380ed699f375ff7a409
commit + 14af241134759373ed539eccd963475cd7f5dcc4
blob - 0bc56d7633cdcb33cb0dd853eb5c642c2582ee30
blob + 28cdce856cbbf9fa0c6ea859c12bc5db81f63c96
--- net/prosody/Makefile
+++ net/prosody/Makefile
@@ -1,6 +1,6 @@
COMMENT = communications server for Jabber/XMPP written in Lua
DISTNAME = prosody-0.12.4
-REVISION = 0
+REVISION = 1
CATEGORIES = net
HOMEPAGE = https://prosody.im/
@@ -49,11 +49,15 @@ FAKE_FLAGS += CONFIG=${DESTDIR}${PREFIX}/share/exampl
pre-configure:
cd ${WRKSRC}; sed -i -e 's,^#!/usr/bin/env lua,#!${MODLUA_BIN},' -e \
- 's,^lua ,${MODLUA_BIN} ,' prosody prosodyctl
+ 's,^lua ,${MODLUA_BIN} ,' prosody prosodyctl \
+ tools/migration/prosody-migrator.lua
post-patch:
${SUBST_CMD} ${WRKSRC}/util/prosodyctl.lua
+post-build:
+ cd ${WRKSRC}/tools/migration && make
+
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/prosody
${INSTALL_DATA} ${WRKSRC}/README \
@@ -61,6 +65,10 @@ post-install:
${INSTALL_DATA} ${WRKSRC}/certs/makefile \
${PREFIX}/share/examples/prosody/certs/Makefile
${INSTALL_DATA} ${WRKSRC}/certs/openssl.cnf \
- ${PREFIX}/share/examples/prosody/certs
+ ${PREFIX}/share/examples/prosody/certs
+ ${INSTALL_SCRIPT} ${WRKSRC}/tools/migration/prosody-migrator.install \
+ ${PREFIX}/sbin/prosody-migrator
+ ${INSTALL_DATA} ${WRKSRC}/tools/migration/migrator.cfg.lua.install \
+ ${PREFIX}/share/examples/prosody/migrator.cfg.lua
.include <bsd.port.mk>
blob - /dev/null
blob + b4579dbde409c88a806a57c33822f00d1c74c8b7 (mode 644)
--- /dev/null
+++ net/prosody/patches/patch-util_prosodyctl_cert_lua
@@ -0,0 +1,14 @@
+Use the right default user.
+
+Index: util/prosodyctl/cert.lua
+--- util/prosodyctl/cert.lua.orig
++++ util/prosodyctl/cert.lua
+@@ -216,7 +216,7 @@ function cert_commands.import(arg)
+ end
+ local owner, group;
+ if pposix.getuid() == 0 then -- We need root to change ownership
+- owner = configmanager.get("*", "prosody_user") or "prosody";
++ owner = configmanager.get("*", "prosody_user") or "_prosody";
+ group = configmanager.get("*", "prosody_group") or owner;
+ end
+ local cm = require "core.certmanager";
blob - /dev/null
blob + b4b09b3ab6a9fa5759da731025eb4e9c5b0b01a3 (mode 644)
--- /dev/null
+++ net/prosody/patches/patch-util_startup_lua
@@ -0,0 +1,14 @@
+Use the right default user.
+
+Index: util/startup.lua
+--- util/startup.lua.orig
++++ util/startup.lua
+@@ -510,7 +510,7 @@ function startup.switch_user()
+ local arg_root = prosody.opts.root;
+ if prosody.current_uid == 0 and config.get("*", "run_as_root") ~= true and not arg_root then
+ -- We haz root!
+- local desired_user = config.get("*", "prosody_user") or "prosody";
++ local desired_user = config.get("*", "prosody_user") or "_prosody";
+ local desired_group = config.get("*", "prosody_group") or desired_user;
+ local ok, err = pposix.setgid(desired_group);
+ if ok then
blob - 7064c733d42d16906934cc69361c966c3e9b40b2
blob + 9eaa4c597962bd797a79dd90513a08d5b1aa5be6
--- net/prosody/pkg/PLIST
+++ net/prosody/pkg/PLIST
@@ -270,6 +270,7 @@ lib/prosody/util/xpcall.lua
lib/prosody/util/xtemplate.lua
@man man/man1/prosodyctl.1
sbin/prosody
+sbin/prosody-migrator
sbin/prosodyctl
share/doc/pkg-readmes/${PKGSTEM}
share/doc/prosody/
@@ -282,6 +283,8 @@ share/examples/prosody/certs/Makefile
@sample ${SYSCONFDIR}/prosody/certs/Makefile
share/examples/prosody/certs/openssl.cnf
@sample ${SYSCONFDIR}/prosody/certs/openssl.cnf
+share/examples/prosody/migrator.cfg.lua
+@sample ${SYSCONFDIR}/prosody/migrator.cfg.lua
share/examples/prosody/prosody.cfg.lua
@sample ${SYSCONFDIR}/prosody/prosody.cfg.lua
@mode 770
blob - 128e541036b83088608589645138cd485bfec37a
blob + ad138a0d4ca66908effd6cbf3843c4c41e2f154e
--- net/prosody/pkg/README
+++ net/prosody/pkg/README
@@ -6,7 +6,7 @@ Using Prosody in an OpenBSD environment
1) Prosody documentation is available online at:
- http://prosody.im/doc/configure
+ https://prosody.im/doc/configure
Use this information to edit:
@@ -44,3 +44,11 @@ Using Prosody in an OpenBSD environment
For MySQL/MariaDB, also add the following to /etc/login.conf:
prosody:setenv=LD_PRELOAD=/usr/lib/libpthread.so:tc=daemon:
+
+6) It's possible to copy and convert storage backends with:
+
+ # ${TRUEPREFIX}/sbin/prosody-migrator
+
+ The online documentation can be found at:
+
+ https://prosody.im/doc/migrator
net/prosody: install prosody-migrator