From 89a9f01cea2783d51b4f5e307e2d3f6b64e0e603 Mon Sep 17 00:00:00 2001 From: "Anna (cybertailor) Vyalkova" Date: Thu, 17 Nov 2022 20:36:11 +0500 Subject: [PATCH] net-misc/fedigroup: new package, add 1.0.6 Signed-off-by: Anna (cybertailor) Vyalkova --- net-misc/fedigroup/Manifest | 1 + net-misc/fedigroup/fedigroup-1.0.6.ebuild | 38 ++++++++++++++ net-misc/fedigroup/files/fedigroup.confd | 5 ++ net-misc/fedigroup/files/fedigroup.initd | 64 +++++++++++++++++++++++ net-misc/fedigroup/metadata.xml | 12 +++++ 5 files changed, 120 insertions(+) create mode 100644 net-misc/fedigroup/Manifest create mode 100644 net-misc/fedigroup/fedigroup-1.0.6.ebuild create mode 100644 net-misc/fedigroup/files/fedigroup.confd create mode 100644 net-misc/fedigroup/files/fedigroup.initd create mode 100644 net-misc/fedigroup/metadata.xml diff --git a/net-misc/fedigroup/Manifest b/net-misc/fedigroup/Manifest new file mode 100644 index 0000000000..b651ef866b --- /dev/null +++ b/net-misc/fedigroup/Manifest @@ -0,0 +1 @@ +DIST fedigroup.py-1.0.6.tar.gz 17909 BLAKE2B d4a9003d0fd06f3bb74777966b71618cb5283aa017ecf91ac182f8fb460fc028469e13aace678b4319714e555ede2c6f4aa7f16b449efb272bf9a6d441be423f SHA512 0481bd1de94d3d4cf2f5c57c078244a079ac3541393555bcb6b36db88457ed10505d065eeee63da222280e62ec14fb5c492b727da6f6495f1d91936c7b9ea53c diff --git a/net-misc/fedigroup/fedigroup-1.0.6.ebuild b/net-misc/fedigroup/fedigroup-1.0.6.ebuild new file mode 100644 index 0000000000..f0bd8ba5d7 --- /dev/null +++ b/net-misc/fedigroup/fedigroup-1.0.6.ebuild @@ -0,0 +1,38 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{8..11} ) +DISTUTILS_USE_PEP517=setuptools +DISTUTILS_SINGLE_IMPL=1 +inherit distutils-r1 edo + +MY_PN="${PN}.py" +MY_P="${MY_PN}-${PV}" +DESCRIPTION="Emulate group accounts on Mastodon/Pleroma" +HOMEPAGE=" + https://pypi.org/project/fedigroup.py/ + https://github.com/uanet-exception/fedigroup.py +" +SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz" +S="${WORKDIR}/${MY_P}" + +LICENSE="GPL-3+" +SLOT="0" +KEYWORDS="~amd64" + +RDEPEND=" + acct-user/fedigroup + $(python_gen_cond_dep ' + dev-python/mastodon-py[${PYTHON_USEDEP}] + dev-python/requests[${PYTHON_USEDEP}] + ') +" + +src_install() { + distutils-r1_src_install + + newinitd "${FILESDIR}"/fedigroup.initd ${PN} + newconfd "${FILESDIR}"/fedigroup.confd ${PN} +} diff --git a/net-misc/fedigroup/files/fedigroup.confd b/net-misc/fedigroup/files/fedigroup.confd new file mode 100644 index 0000000000..fe8c789d72 --- /dev/null +++ b/net-misc/fedigroup/files/fedigroup.confd @@ -0,0 +1,5 @@ +# Fedigroup bot name +#FEDIGROUP_BOT="${RC_SVCNAME#fedigroup.}" + +# Fedigroup configuration file +#FEDIGROUP_CONFIG="/etc/fedigroup.conf" diff --git a/net-misc/fedigroup/files/fedigroup.initd b/net-misc/fedigroup/files/fedigroup.initd new file mode 100644 index 0000000000..cb27094c4f --- /dev/null +++ b/net-misc/fedigroup/files/fedigroup.initd @@ -0,0 +1,64 @@ +#!/sbin/openrc-run +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 +# shellcheck shell=sh disable=SC2034 + +: ${FEDIGROUP_BOT:=${RC_SVCNAME#fedigroup.}} +: ${FEDIGROUP_CONFIG:=/etc/fedigroup.conf} + +extra_commands="create remove list" +description_create="create a new bot" +description_remove="remove selected bot from config file" +description_list="list all bots from config file" + +command="/usr/bin/fedigroup.py" +command_args="run ${FEDIGROUP_BOT} -c ${FEDIGROUP_CONFIG}" +command_user="fedigroup:fedigroup" +command_background=yes +pidfile="/run/${RC_SVCNAME}.pid" +output_log="/var/log/${RC_SVCNAME}.log" +error_log="${output_log}" + +depend() { + need net +} + +fix_config_perms() { + checkpath -q -o fedigroup:fedigroup -m 0640 -f "${FEDIGROUP_CONFIG}" +} + +start_pre() { + if [ "${FEDIGROUP_BOT}" = "${RC_SVCNAME}" ]; then + eerror "Missing FEDIGROUP_BOT variable" + return 1 + fi + + fix_config_perms || return 1 + + return 0 +} + +create() { + local name="" + printf "Enter the name of the bot to be created: " + read name + + fix_config_perms || return 1 + "${command}" create "${name}" -c "${FEDIGROUP_CONFIG}" || return 1 +} + +remove() { + local name="" + printf "Enter the name of the bot to be removed: " + read name + + fix_config_perms || return 1 + start-stop-daemon --quiet --exec "${command}" \ + -- remove "${name}" -c "${FEDIGROUP_CONFIG}" || return 1 +} + +list() { + fix_config_perms || return 1 + start-stop-daemon --quiet --exec "${command}" \ + -- list -c "${FEDIGROUP_CONFIG}" || return 1 +} diff --git a/net-misc/fedigroup/metadata.xml b/net-misc/fedigroup/metadata.xml new file mode 100644 index 0000000000..ff852796e7 --- /dev/null +++ b/net-misc/fedigroup/metadata.xml @@ -0,0 +1,12 @@ + + + + + cyber+gentoo@sysrq.in + Anna + + + fedigroup.py + uanet-exception/fedigroup.py + +