* [gentoo-commits] repo/proj/guru:dev commit in: www-apps/snac/, www-apps/snac/files/
@ 2022-12-02 6:15 Anna Vyalkova
0 siblings, 0 replies; only message in thread
From: Anna Vyalkova @ 2022-12-02 6:15 UTC (permalink / raw
To: gentoo-commits
commit: f44cdd34807d42349c73a9eb84634408be3aec05
Author: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
AuthorDate: Thu Dec 1 15:13:00 2022 +0000
Commit: Anna Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
CommitDate: Fri Dec 2 06:13:10 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=f44cdd34
www-apps/snac: new package, add 2.12
Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq.in>
www-apps/snac/Manifest | 1 +
www-apps/snac/files/snac | 52 +++++++++++++++++++++++++++++++++++++++
www-apps/snac/files/snac.service | 15 ++++++++++++
www-apps/snac/metadata.xml | 8 ++++++
www-apps/snac/snac-2.12.ebuild | 53 ++++++++++++++++++++++++++++++++++++++++
5 files changed, 129 insertions(+)
diff --git a/www-apps/snac/Manifest b/www-apps/snac/Manifest
new file mode 100644
index 000000000..6efab6dca
--- /dev/null
+++ b/www-apps/snac/Manifest
@@ -0,0 +1 @@
+DIST snac-2.12.tar.gz 65818 BLAKE2B a9c7e43a10ee32aa31b2f58b5557199f16f3b03d118b17151215586428c5e98d3aa2e9fb9f2fc1ffec47650e103134d1d53df8db75c54aa95996cc07505f6aaf SHA512 6b9259e6a91e30be907851d28ff8998bda0c19be95c0c9c76bed37e1a4ce87a900b5903fac62a199603f9f078861bbbb55e1549604176a95b71cd9eff88925d8
diff --git a/www-apps/snac/files/snac b/www-apps/snac/files/snac
new file mode 100644
index 000000000..3e09749eb
--- /dev/null
+++ b/www-apps/snac/files/snac
@@ -0,0 +1,52 @@
+#!/sbin/openrc-run
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+# shellcheck shell=sh
+
+: ${SNAC_DATA:=/var/lib/snac/data}
+
+extra_stopped_commands="init"
+extra_commands="adduser"
+description_init="Create the database"
+description_adduser="Create a user"
+
+command="/usr/bin/snac"
+command_args="httpd ${SNAC_DATA}"
+command_user="snac:snac"
+command_background=yes
+pidfile="/run/snac.pid"
+output_logger="logger -p daemon.info -t snac --"
+error_logger="logger -p daemon.err -t snac --"
+
+depend() {
+ use logger
+ need net
+}
+
+check_db() {
+ if [ ! -f "${SNAC_DATA}"/server.json ]; then
+ eerror "Please run 'rc-service snac init' before the first start"
+ return 1
+ fi
+
+ return 0
+}
+
+start_pre() {
+ check_db || return 1
+
+ start-stop-daemon --exec "${command}" --user "${command_user}" \
+ -- purge "${SNAC_DATA}"
+}
+
+init() {
+ start-stop-daemon --exec "${command}" --user "${command_user}" \
+ -- init "${SNAC_DATA}"
+}
+
+adduser() {
+ check_db || return 1
+
+ start-stop-daemon --exec "${command}" --user "${command_user}" \
+ -- adduser "${SNAC_DATA}"
+}
diff --git a/www-apps/snac/files/snac.service b/www-apps/snac/files/snac.service
new file mode 100644
index 000000000..35f90db6c
--- /dev/null
+++ b/www-apps/snac/files/snac.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=A simple, minimalistic ActivityPub instance
+After=network.target
+Wants=network-online.target
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/snac httpd /var/lib/snac/data
+Restart=always
+RestartSec=5
+User=snac
+Group=snac
+
+[Install]
+WantedBy=multi-user.target
diff --git a/www-apps/snac/metadata.xml b/www-apps/snac/metadata.xml
new file mode 100644
index 000000000..7ebbd0334
--- /dev/null
+++ b/www-apps/snac/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>cyber+gentoo@sysrq.in</email>
+ <name>Anna</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/www-apps/snac/snac-2.12.ebuild b/www-apps/snac/snac-2.12.ebuild
new file mode 100644
index 000000000..419bef237
--- /dev/null
+++ b/www-apps/snac/snac-2.12.ebuild
@@ -0,0 +1,53 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit systemd toolchain-funcs
+
+MY_PN="snac2"
+DESCRIPTION="A simple, minimalistic ActivityPub instance"
+HOMEPAGE="https://codeberg.org/grunfink/snac2"
+SRC_URI="https://codeberg.org/grunfink/${MY_PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/${MY_PN}"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+DEPEND="
+ dev-libs/openssl:=
+ net-misc/curl
+"
+RDEPEND="${DEPEND}
+ acct-user/snac
+"
+
+DOCS=( {README,RELEASE_NOTES,TODO}.md )
+
+src_configure() {
+ tc-export CC
+}
+
+src_compile() {
+ emake CFLAGS="${CFLAGS}"
+}
+
+src_install() {
+ mkdir -p "${ED}"/usr/bin
+ emake PREFIX="${ED}/usr" PREFIX_MAN="${ED}/usr/share/man" install
+ einstalldocs
+
+ doinitd "${FILESDIR}"/snac
+ systemd_dounit "${FILESDIR}"/snac.service
+
+ diropts --owner snac --group snac
+ keepdir /var/lib/snac
+}
+
+pkg_postinst() {
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ einfo "To finish the installation, please run:"
+ einfo " # rc-service snac init"
+ fi
+}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-12-02 6:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-02 6:15 [gentoo-commits] repo/proj/guru:dev commit in: www-apps/snac/, www-apps/snac/files/ Anna Vyalkova
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox