diff options
author | Conrad Kostecki <conikost@gentoo.org> | 2022-03-19 18:57:54 +0100 |
---|---|---|
committer | Conrad Kostecki <conikost@gentoo.org> | 2022-03-19 19:24:11 +0100 |
commit | 02dd94ab9cf21d6516187fdfeee4e54bba86561b (patch) | |
tree | b6f892b3a37fd336e12b81fb4a88b262ce0e6f29 /net-im | |
parent | sys-block/scsirastools: drop 1.5.7-r1, 1.6.4-r1 (diff) | |
download | gentoo-02dd94ab9cf21d6516187fdfeee4e54bba86561b.tar.gz gentoo-02dd94ab9cf21d6516187fdfeee4e54bba86561b.tar.bz2 gentoo-02dd94ab9cf21d6516187fdfeee4e54bba86561b.zip |
net-im/prosody: add 0.12.0
This is a new major release, which brings lua5-4 support, but also
migrates away from jabber-base by providing it's own user and group
among new unified pathes for prosody.
Additionally, current data is being copy-migrated to new locations.
Signed-off-by: Conrad Kostecki <conikost@gentoo.org>
Diffstat (limited to 'net-im')
-rw-r--r-- | net-im/prosody/Manifest | 1 | ||||
-rw-r--r-- | net-im/prosody/files/prosody-0.12.0-gentoo.patch | 29 | ||||
-rw-r--r-- | net-im/prosody/files/prosody.initd-r6 | 46 | ||||
-rw-r--r-- | net-im/prosody/files/prosody.service-r3 | 17 | ||||
-rw-r--r-- | net-im/prosody/files/prosody.tmpfilesd-r2 | 1 | ||||
-rw-r--r-- | net-im/prosody/prosody-0.12.0.ebuild | 164 |
6 files changed, 258 insertions, 0 deletions
diff --git a/net-im/prosody/Manifest b/net-im/prosody/Manifest index ec1e363a1b2c..6fde68aca00c 100644 --- a/net-im/prosody/Manifest +++ b/net-im/prosody/Manifest @@ -1 +1,2 @@ DIST prosody-0.11.13.tar.gz 439816 BLAKE2B 8ace9001fe93d6349c744d17c7bccbf18c8704615cea856efcadd2de54430a64241cf7930345163e7bb6067aa4731da15dde4fc7f3ddb868b0680facc5368230 SHA512 7616785536b7b51767a26963a80c961ef2403609e1e78dda3f88cf68c00d5bb899278c70a22b006b58c36c62cbb1bbd390a9298bad5b8d6524928a1cd5457813 +DIST prosody-0.12.0.tar.gz 610330 BLAKE2B 14694ee95dc6eb6d053278a9d7718fd7487fe7ef862b4e2ee0d57f2b60cdeb22d1c74eac4a4df7447ea3e9ff57fb3734a9c9997f2767ed3aa04682f265b82185 SHA512 b7144a413a5bc72b1e677504d5ced6583c7399c8334b39b4c9157da60f951300832b34a1d47703a0b217caa4f1d3a0f52ab59cef08b27c6b43e876e1dffca3ce diff --git a/net-im/prosody/files/prosody-0.12.0-gentoo.patch b/net-im/prosody/files/prosody-0.12.0-gentoo.patch new file mode 100644 index 000000000000..3b2ba75b15c8 --- /dev/null +++ b/net-im/prosody/files/prosody-0.12.0-gentoo.patch @@ -0,0 +1,29 @@ +--- a/prosody.cfg.lua.dist ++++ b/prosody.cfg.lua.dist +@@ -17,6 +17,15 @@ + -- Settings in this section apply to the whole server and are the default settings + -- for any virtual hosts + ++-- Prosody will use this user and group for launching the service. ++-- Gentoo uses by default prosody:prosody (uid:gid) for all Jabber related services. ++prosody_user = "prosody" ++prosody_group = "prosody" ++ ++-- Prosody will create this pid file after it has been successfully started. ++-- Please don't change that path, as it's being used by the Gentoo init scripts. ++pidfile = "/run/prosody/prosody.pid" ++ + -- This is a (by default, empty) list of accounts that are admins + -- for the server. Note that you must create the accounts separately + -- (see https://prosody.im/doc/creating_accounts for info) +@@ -26,7 +35,9 @@ + -- This option allows you to specify additional locations where Prosody + -- will search first for modules. For additional modules you can install, see + -- the community module repository at https://modules.prosody.im/ +---plugin_paths = {} ++-- The default included path is for the optional net-im/prosody-modules package, ++-- which provides additional community maintained modules. ++plugin_paths = { "/usr/GENTOO_LIBDIR/prosody/modules", "/usr/GENTOO_LIBDIR/prosody/community-modules" }; + + -- This is the list of modules Prosody will load on startup. + -- Documentation for bundled modules can be found at: https://prosody.im/doc/modules diff --git a/net-im/prosody/files/prosody.initd-r6 b/net-im/prosody/files/prosody.initd-r6 new file mode 100644 index 000000000000..e4138c597b23 --- /dev/null +++ b/net-im/prosody/files/prosody.initd-r6 @@ -0,0 +1,46 @@ +#!/sbin/openrc-run +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +extra_started_commands="reload" +name="Prosody XMPP server" +prosody_config="/etc/prosody/prosody.cfg.lua" +prosody_data="/var/lib/prosody" +prosody_logs="/var/log/prosody" +prosody_pid="/run/prosody" +pidfile="${prosody_pid}/prosody.pid" + +command="/usr/bin/prosody" +command_args="--daemonize" +commandctl="/usr/bin/prosodyctl" +command_group="prosody" +command_user="prosody" + +checkconfig() { + if [ ! -f "${prosody_config}" ]; then + eerror "Please create ${prosody_config} before starting Prosody!" + return 1 + fi + + ${commandctl} check config + return $? +} + +depend() { + need net + use dns postgresql +} + +reload() { + ebegin "Reloading configuration" + start-stop-daemon --signal HUP --pidfile "${pidfile}" + eend $? +} + +start_pre() { + checkconfig || return 1 + + checkpath -d -m 0750 -o "${command_user}:${command_group}" -q "${prosody_data}" + checkpath -d -m 0750 -o "${command_user}:${command_group}" -q "${prosody_logs}" + checkpath -d -m 0750 -o "${command_user}:${command_group}" -q "${prosody_pid}" +} diff --git a/net-im/prosody/files/prosody.service-r3 b/net-im/prosody/files/prosody.service-r3 new file mode 100644 index 000000000000..dec39e4b0b22 --- /dev/null +++ b/net-im/prosody/files/prosody.service-r3 @@ -0,0 +1,17 @@ +[Unit] +Description=Prosody XMPP server +After=network.target + +[Service] +Group=prosody +PIDFile=/run/prosody/prosody.pid +ExecStart=/usr/bin/prosody --daemonize +ExecReload=/bin/kill -HUP $MAINPID +User=prosody +ExecStartPre=!/bin/mkdir -p /var/log/prosody +ExecStartPre=!/bin/mkdir -p /var/lib/prosody +ExecStartPre=!/bin/chown -R prosody /var/log/prosody +ExecStartPre=!/bin/chown -R prosody /var/lib/prosody + +[Install] +WantedBy=multi-user.target diff --git a/net-im/prosody/files/prosody.tmpfilesd-r2 b/net-im/prosody/files/prosody.tmpfilesd-r2 new file mode 100644 index 000000000000..78949f3db82c --- /dev/null +++ b/net-im/prosody/files/prosody.tmpfilesd-r2 @@ -0,0 +1 @@ +d /run/prosody 750 prosody prosody - - diff --git a/net-im/prosody/prosody-0.12.0.ebuild b/net-im/prosody/prosody-0.12.0.ebuild new file mode 100644 index 000000000000..e9cab9fb7d64 --- /dev/null +++ b/net-im/prosody/prosody-0.12.0.ebuild @@ -0,0 +1,164 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LUA_COMPAT=( lua5-{1..4} luajit ) +LUA_REQ_USE="deprecated(+)" + +inherit lua-single systemd tmpfiles toolchain-funcs + +DESCRIPTION="Prosody is a modern XMPP communication server" +HOMEPAGE="https://prosody.im/" +SRC_URI="https://prosody.im/downloads/source/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~x86" +IUSE="icu +idn +libevent ldap mysql postgres selinux +sqlite +ssl test +zlib" +REQUIRED_USE=" + ^^ ( icu idn ) + ${LUA_REQUIRED_USE} +" +RESTRICT="!test? ( test )" + +DEPEND=" + acct-group/prosody + acct-user/prosody + $(lua_gen_cond_dep 'dev-lua/luaexpat[${LUA_USEDEP}]') + $(lua_gen_cond_dep 'dev-lua/luafilesystem[${LUA_USEDEP}]') + dev-lua/luarocks[${LUA_SINGLE_USEDEP}] + $(lua_gen_cond_dep 'dev-lua/luasocket[${LUA_USEDEP}]') + $(lua_gen_cond_dep 'dev-lua/lua-unbound[${LUA_USEDEP}]') + $(lua_gen_cond_dep 'dev-lua/readline[${LUA_USEDEP}]') + icu? ( dev-libs/icu:= ) + idn? ( net-dns/libidn:= ) + ldap? ( $(lua_gen_cond_dep 'dev-lua/lualdap[${LUA_USEDEP}]') ) + libevent? ( $(lua_gen_cond_dep 'dev-lua/luaevent[${LUA_USEDEP}]') ) + dev-libs/openssl:0= + lua_single_target_lua5-1? ( $(lua_gen_cond_dep 'dev-lua/lua-bit32[lua_targets_lua5-1(-)]') ) + mysql? ( $(lua_gen_cond_dep 'dev-lua/luadbi[mysql,${LUA_USEDEP}]') ) + postgres? ( $(lua_gen_cond_dep 'dev-lua/luadbi[postgres,${LUA_USEDEP}]') ) + sqlite? ( $(lua_gen_cond_dep 'dev-lua/luadbi[sqlite,${LUA_USEDEP}]') ) + ssl? ( $(lua_gen_cond_dep 'dev-lua/luasec[${LUA_USEDEP}]') ) + zlib? ( $(lua_gen_cond_dep 'dev-lua/lua-zlib[${LUA_USEDEP}]') ) + ${LUA_DEPS} +" + +RDEPEND=" + ${DEPEND} + selinux? ( sec-policy/selinux-jabber ) +" + +BDEPEND=" + virtual/pkgconfig + test? ( $(lua_gen_cond_dep 'dev-lua/busted[${LUA_USEDEP}]') ) +" + +PATCHES=( "${FILESDIR}/${PN}-0.12.0-gentoo.patch" ) + +src_prepare() { + default + + # Set correct plugin path for optional net-im/prosody-modules package + sed -e "s/GENTOO_LIBDIR/$(get_libdir)/g" -i prosody.cfg.lua.dist || die +} + +src_configure() { + local myeconfargs=( + --add-cflags="${CFLAGS}" + --add-ldflags="${LDFLAGS}" + --c-compiler="$(tc-getCC)" + --datadir="${EPREFIX}/var/lib/prosody" + --idn-library="$(usex idn 'idn' 'icu')" + --libdir="${EPREFIX}/usr/$(get_libdir)" + --linker="$(tc-getCC)" + --lua-version="$(usex lua_single_target_luajit '5.1' $(ver_cut 1-2 $(lua_get_version)))" + --no-example-certs + --ostype="linux" + --prefix="${EPREFIX}/usr" + --runwith="${ELUA}" + --sysconfdir="${EPREFIX}/etc/prosody" + --with-lua-include="${EPREFIX}/$(lua_get_include_dir)" + --with-lua-lib="${EPREFIX}/$(lua_get_cmod_dir)" + ) + + # Since the configure script is handcrafted, + # and yells at unknown options, do not use 'econf'. + ./configure "${myeconfargs[@]}" || die + + rm makefile || die + mv GNUmakefile Makefile || die +} + +src_install() { + default + + keepdir /var/lib/prosody + + newinitd "${FILESDIR}"/prosody.initd-r6 prosody + systemd_newunit "${FILESDIR}"/prosody.service-r3 prosody.service + + newtmpfiles "${FILESDIR}"/prosody.tmpfilesd-r2 prosody.conf +} + +pkg_postinst() { + local migrate_to_prosody_user="false" + tmpfiles_process prosody.conf + + if [[ ${REPLACING_VERSIONS} ]]; then + for v in ${REPLACING_VERSIONS}; do + if ver_test "${v}" -lt 0.12.0; then + migrate_to_prosody_user="true" + break + fi + done + fi + + # Sarting with >=0.12.0, the prosody configuration is now in + # /etc/prosody and no longer in /etc/jabber. + # See if we need to migrate the configuration. Furthermore, + # prosody no longer runs under the, shared via net-im/jabber-base, + # 'jabber' use, but under its own user. + # This increase isolation and hence robustness and security. + if ${migrate_to_prosody_user}; then + local -A dirs_to_migrate=( + [/etc/jabber]=/etc/prosody + [/var/log/jabber]=/var/log/prosody + [/var/spool/jabber]=/var/lib/prosody + ) + + for src_dir in "${!dirs_to_migrate[@]}"; do + local eroot_src_dir="${EROOT}/${src_dir}" + local eroot_dst_dir="${EROOT}/${dirs_to_migrate[${src_dir}]}" + + cp -r "${eroot_src_dir}"/. "${eroot_dst_dir}" || die "Could not copy ${eroot_src_dir} to ${eroot_dst_dir}" + + if [[ -f "${eroot_dst_dir}"/.keep_net-im_jabber-base-0 ]]; then + rm "${eroot_dst_dir}"/.keep_net-im_jabber-base-0 || die + fi + + if ! use prefix; then + chown --recursive prosody:prosody "${eroot_dst_dir}" || die + fi + done + + # Update configuration file to match new pathes and permissions + local mysedargs=( + -e "'s#/etc/jabber#/etc/prosody#g'" + -e "'s#/run/jabber#/run/prosody#g'" + -e "'s#/var/log/jabber#/var/log/prosody#g'" + -e "'s/prosody_user.*/prosody_user = \"prosody\";/g'" + -e "'s/prosody_group.*/prosody_group = \"prosody\";/g'" + -i /etc/prosody/prosody.cfg.lua + ) + + eval sed "${mysedargs[@]}" || die + + ewarn "Newer versions of the prosody (Gentoo) package use ${EROOT}/etc/prosody" + ewarn "(just as upstream) and *not* anymore ${EROOT}/etc/jabber." + ewarn "The files from ${EROOT}/etc/jabber where copied to ${EROOT}/etc/prosody." + ewarn "Also prosody's spool directory became ${EROOT}/var/lib/prosody (was ${EROOT}/var/spool/jabbber)." + ewarn "Please check your configuration." + fi +} |