Revert "www-apps/gotosocial: treeclean"

This reverts commit 21086a769ada57003475d5bf4321c0f23fcc4136.

Signed-off-by: Skyler Mäntysaari <sm+gentoo@skym.fi>
This commit is contained in:
Skyler Mäntysaari 2025-02-11 15:08:08 +02:00
parent ba8e09c1fc
commit bb749d2fc4
No known key found for this signature in database
GPG Key ID: 5CBFF29F9005BCE1
8 changed files with 282 additions and 0 deletions

View File

@ -0,0 +1,4 @@
DIST gotosocial-0.10.0-source-code.tar.gz 55714610 BLAKE2B 5db1bb11d799cc85e7667c205a19df88b901598dfa64cb2b10c58ee6ea327cf5d2e74cba58312d5b7444200ca8a6866b6305008e41775f2906db8faddb078b92 SHA512 fc647e6fb35ef8a9969014d4e785f868e5c85fb2305f7ac204ba830d0774cf4fa7cbb25b7a47fed0b8f592e45299cb2bdbbf5f4a6ae45915a540e9c3ab92f3c4
DIST gotosocial-0.9.0-source-code.tar.gz 55117728 BLAKE2B e9a02e3d6b27d242db3a239e95653973a498b67e606824d8a2ff141498b8bbf6be0f434d96abad2129e7ca4dab379b815ac04749e036caf0963d6160508768bd SHA512 7638a069a47d615264baa74d838052f913b6c71497396c2d2b877a870a5ad1639d218dd9877fb6b37c347d4e243524527260f48f983a68bb29c4b76ec3ce8c7c
DIST gotosocial_0.10.0_web-assets.tar.gz 1362405 BLAKE2B 78168bcffbc5081cfb81ddcba314d3aa58e41fd115303997306495ad79c5d6fa3d2540b1d4da87e43cf7c4f62e737a859c5bdf2959d60371e25125dd21567f9e SHA512 4a6b2248969e9e254764e4b03fa6d7d884d74da8b25665feebca117eeeeae3aa3dc8fca995ca7c939f6437aa35b7d09dbd824727c7d0a7a4745db29916ab74be
DIST gotosocial_0.9.0_web-assets.tar.gz 1357671 BLAKE2B aeab657eb72db5178287afd75b6c1d06238f8c769f3bfc21cf6249b8eed468b7009b2401c64aca22964ebd7a6554066a2c38d9d441a39789c731faa6e9c17c29 SHA512 0d83b093ab8f45ae8ed3eebcf1aed66b27a5d996e5c0dc30e16cc99a881b7e2b333ba4cf4fd78486c42b3bef9245d1ba89743a87ae0f969e8be6a756cf1dcfc6

View File

@ -0,0 +1,2 @@
# GoToSocial configuration file
#GOTOSOCIAL_CONFIG="/etc/gotosocial/config.yaml"

View File

@ -0,0 +1,42 @@
#!/sbin/openrc-run
# Copyright 2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# shellcheck shell=sh disable=SC2034
: ${GOTOSOCIAL_CONFIG:=/etc/gotosocial/config.yaml}
extra_commands="adduser"
description_adduser="create a user"
description="GoToSocial Server"
command="/usr/bin/gotosocial"
command_args="--config-path ${GOTOSOCIAL_CONFIG} server start"
command_user="gotosocial:gotosocial"
command_background=yes
pidfile="/run/gotosocial.pid"
depend() {
need net
after postgresql
}
adduser() {
# handle Ctrl+C
trap "stty echo" INT
printf "Enter username: "
read username
printf "Enter email: "
read email
stty -echo
printf "Enter password: "
read password
stty echo
start-stop-daemon --exec "${command}" --user "${command_user}" -- \
--config-path "${GOTOSOCIAL_CONFIG}" admin account create \
--username "${username}" --email "${email}" --password "${password}"
return $?
}

View File

@ -0,0 +1,45 @@
[Unit]
Description=GoToSocial Server
[Service]
User=gotosocial
Group=gotosocial
Type=exec
Restart=on-failure
ExecStart=/usr/bin/gotosocial --config-path /etc/gotosocial/config.yaml server start
StandardOutput=append:/var/log/gotosocial/gotosocial.log
StandardError=inherit
# Sandboxing options to harden security
NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
DevicePolicy=closed
ProtectSystem=full
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
LockPersonality=yes
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
# Denying access to capabilities that should not be relevant
CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
# You might need this if you are running as non-root on a privileged port (below 1024)
#AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=default.target

View File

@ -0,0 +1 @@
d /var/lib/gotosocial 0755 gotosocial gotosocial -

View File

@ -0,0 +1,88 @@
# Copyright 2022-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit go-module systemd tmpfiles
DESCRIPTION="Fast, fun, ActivityPub server, powered by Go"
HOMEPAGE="
https://gotosocial.org/
https://github.com/superseriousbusiness/gotosocial
"
GH_RELEASE="https://github.com/superseriousbusiness/${PN}/releases/download/v${PV}"
SRC_URI="
${GH_RELEASE}/${P}-source-code.tar.gz
${GH_RELEASE}/${PN}_${PV}_web-assets.tar.gz
"
S="${WORKDIR}"
LICENSE="|| ( WTFPL-2 CC0-1.0 ) AGPL-3 Apache-2.0 BSD BSD-2 CC0-1.0 GPL-3 MIT MPL-2.0"
SLOT="0"
KEYWORDS="~amd64"
RDEPEND="acct-user/gotosocial"
DOCS=( archive {CONTRIBUTING,README,ROADMAP}.md )
src_unpack() {
# source code
unpack ${P}-source-code.tar.gz
rm -r web || die
# prebuilt web assets
unpack ${PN}_${PV}_web-assets.tar.gz
}
src_prepare() {
default
sed -i example/config.yaml \
-e "s|./web/template/|${EPREFIX}/usr/share/gotosocial/web/template/|g" \
-e "s|./web/assets/|${EPREFIX}/usr/share/gotosocial/web/assets/|g" \
-e "s|/gotosocial/storage|${EPREFIX}/var/lib/gotosocial/storage|g" \
|| die
}
src_configure() {
GOFLAGS+=" -tags=netgo,osusergo,static_build,kvformat"
}
src_compile() {
local myargs=(
-trimpath
-ldflags "-X main.Version=${PV}"
)
ego build "${myargs[@]}" ./cmd/gotosocial
}
src_test() {
local -x GTS_DB_TYPE="sqlite"
local -x GTS_DB_ADDRESS=":memory:"
local -x GOFLAGS
GOFLAGS="${GOFLAGS//-v/}"
GOFLAGS="${GOFLAGS//-x/}"
ego test -vet off ./...
}
src_install() {
dobin gotosocial
newinitd "${FILESDIR}"/gotosocial.initd ${PN}
newconfd "${FILESDIR}"/gotosocial.confd ${PN}
systemd_dounit "${FILESDIR}"/gotosocial.service
newtmpfiles "${FILESDIR}"/gotosocial.tmpfiles ${PN}.conf
insinto /usr/share/gotosocial
doins -r web
insinto /etc/gotosocial
doins example/config.yaml
}
pkg_postinst() {
tmpfiles_process ${PN}.conf
}

View File

@ -0,0 +1,91 @@
# Copyright 2022-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit go-module systemd tmpfiles
DESCRIPTION="Fast, fun, ActivityPub server, powered by Go"
HOMEPAGE="
https://gotosocial.org/
https://github.com/superseriousbusiness/gotosocial
"
GH_RELEASE="https://github.com/superseriousbusiness/${PN}/releases/download/v${PV}"
SRC_URI="
${GH_RELEASE}/${P}-source-code.tar.gz
${GH_RELEASE}/${PN}_${PV}_web-assets.tar.gz
"
S="${WORKDIR}"
LICENSE="|| ( WTFPL-2 CC0-1.0 ) AGPL-3 Apache-2.0 BSD BSD-2 CC0-1.0 GPL-3 MIT MPL-2.0"
SLOT="0"
KEYWORDS="~amd64"
# Flaky tests
RESTRICT="test"
RDEPEND="acct-user/gotosocial"
DOCS=( archive {CONTRIBUTING,README,ROADMAP}.md )
src_unpack() {
# source code
unpack ${P}-source-code.tar.gz
rm -r web || die
# prebuilt web assets
unpack ${PN}_${PV}_web-assets.tar.gz
}
src_prepare() {
default
sed -i example/config.yaml \
-e "s|./web/template/|${EPREFIX}/usr/share/gotosocial/web/template/|g" \
-e "s|./web/assets/|${EPREFIX}/usr/share/gotosocial/web/assets/|g" \
-e "s|/gotosocial/storage|${EPREFIX}/var/lib/gotosocial/storage|g" \
|| die
}
src_configure() {
GOFLAGS+=" -tags=netgo,osusergo,static_build,kvformat"
}
src_compile() {
local myargs=(
-trimpath
-ldflags "-X main.Version=${PV}"
)
ego build "${myargs[@]}" ./cmd/gotosocial
}
src_test() {
local -x GTS_DB_TYPE="sqlite"
local -x GTS_DB_ADDRESS=":memory:"
local -x GOFLAGS
GOFLAGS="${GOFLAGS//-v/}"
GOFLAGS="${GOFLAGS//-x/}"
ego test -vet off ./...
}
src_install() {
dobin gotosocial
newinitd "${FILESDIR}"/gotosocial.initd ${PN}
newconfd "${FILESDIR}"/gotosocial.confd ${PN}
systemd_dounit "${FILESDIR}"/gotosocial.service
newtmpfiles "${FILESDIR}"/gotosocial.tmpfiles ${PN}.conf
insinto /usr/share/gotosocial
doins -r web
insinto /etc/gotosocial
doins example/config.yaml
}
pkg_postinst() {
tmpfiles_process ${PN}.conf
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<!-- maintainer-needed -->
<upstream>
<doc>https://docs.gotosocial.org/</doc>
<remote-id type="github">superseriousbusiness/gotosocial</remote-id>
</upstream>
</pkgmetadata>