From 498e5b5f6f218789a61fe4f0baddf43f3cd794db Mon Sep 17 00:00:00 2001 From: Micha Glave Date: Mon, 1 Jun 2026 15:23:18 +0200 Subject: [PATCH] new ebuild `www-apps/ntfy` Send push notifications to your phone or desktop using PUT/POST --- acct-group/ntfy/ntfy-0.ebuild | 10 ++++++ acct-user/ntfy/ntfy-0.ebuild | 13 ++++++++ www-apps/ntfy/Manifest | 1 + www-apps/ntfy/files/client.initd | 16 ++++++++++ www-apps/ntfy/files/server.initd | 49 +++++++++++++++++++++++++++++ www-apps/ntfy/ntfy-2.23.0.ebuild | 54 ++++++++++++++++++++++++++++++++ 6 files changed, 143 insertions(+) create mode 100644 acct-group/ntfy/ntfy-0.ebuild create mode 100644 acct-user/ntfy/ntfy-0.ebuild create mode 100644 www-apps/ntfy/Manifest create mode 100755 www-apps/ntfy/files/client.initd create mode 100644 www-apps/ntfy/files/server.initd create mode 100644 www-apps/ntfy/ntfy-2.23.0.ebuild diff --git a/acct-group/ntfy/ntfy-0.ebuild b/acct-group/ntfy/ntfy-0.ebuild new file mode 100644 index 0000000..6f5acfe --- /dev/null +++ b/acct-group/ntfy/ntfy-0.ebuild @@ -0,0 +1,10 @@ +# Copyright 2020-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit acct-group + +DESCRIPTION="gid for www-apps/ntfy" + +ACCT_GROUP_ID=778 diff --git a/acct-user/ntfy/ntfy-0.ebuild b/acct-user/ntfy/ntfy-0.ebuild new file mode 100644 index 0000000..ef94132 --- /dev/null +++ b/acct-user/ntfy/ntfy-0.ebuild @@ -0,0 +1,13 @@ +# Copyright 2020-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit acct-user + +DESCRIPTION="uid for www-apps/ntfy" +ACCT_USER_ID=778 +ACCT_USER_HOME=/var/lib/ntfy +ACCT_USER_GROUPS=( ${PN} ) + +acct-user_add_deps diff --git a/www-apps/ntfy/Manifest b/www-apps/ntfy/Manifest new file mode 100644 index 0000000..5c9523b --- /dev/null +++ b/www-apps/ntfy/Manifest @@ -0,0 +1 @@ +DIST ntfy_2.23.0_linux_amd64.tar.gz 31238864 BLAKE2B 9eaa06d6bb63b1c6aaf60ec76cdb53b3eba98073967361919615b143447eb1846c301fb9fc8c85ac2167ff684f3e4a5493269408b22e80a924e451a3a472d5a3 SHA512 ce491c1d5114a60967b56bb9027013f810259510b05e4a8bb8d932632d86f262be1f612b6e10161332f7bc46e3c43f631a962cbedfb73c1579ea38abe0d97f29 diff --git a/www-apps/ntfy/files/client.initd b/www-apps/ntfy/files/client.initd new file mode 100755 index 0000000..181e464 --- /dev/null +++ b/www-apps/ntfy/files/client.initd @@ -0,0 +1,16 @@ +#!/sbin/openrc-run +# Copyright 1999-2026 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +name="ntfy-client - Send push notifications to your phone or desktop using PUT/POST" + +command="/usr/bin/ntfy" +command_args="subscribe --config /etc/ntfy/client.yml --from-config" +command_background="true" +command_user="ntfy:ntfy" +error_log="/var/log/ntfy-client.log" +pidfile="/run/ntfy-client.pid" + +depend() { + need net +} diff --git a/www-apps/ntfy/files/server.initd b/www-apps/ntfy/files/server.initd new file mode 100644 index 0000000..fff344d --- /dev/null +++ b/www-apps/ntfy/files/server.initd @@ -0,0 +1,49 @@ +#!/sbin/openrc-run + +# OpenRC service configuration for ntfy Server. +# Should be placed in /etc/init.d/ as "ntfy" or "ntfy-server" (no extension), owned by root:root and with permissions 755. +# Assumes an ntfy system user and group have been created, for example using this command: +# useradd --system --home-dir /var/lib/ntfy --shell /bin/false --comment "User for the simple HTTP-based pub-sub notification service" ntfy + +name=$RC_SVCNAME +description="ntfy server" + +command="/usr/bin/ntfy" +command_background=true +command_args="serve" +command_user="ntfy:ntfy" +extra_started_commands="reload" + +pidfile="/run/${RC_SVCNAME}/${RC_SVCNAME}.pid" + +# Changes the hard number of open files (nofile) limit to 2048 for the service. +rc_ulimit="-n 2048" + +# Allows the service to bind to privileged ports (<1024). +capabilities="^cap_net_bind_service" + +error_log="/var/log/ntfy.log" + +# Service dependencies +depend() { + use net + after firewall +} + +# Check for - and if necessary - create required files and folders. Might require some adjustment dependings on the content of the server.yml file. +start_pre() { + checkpath -f --owner "$command_user" --mode 0644 \ + /var/log/ntfy.log + checkpath -d --owner "$command_user" --mode 0750 \ + /run/ntfy/ + checkpath -d --owner "$command_user" --mode 0755 \ + /var/lib/ntfy/ + checkpath -d --owner "$command_user" --mode 0750 \ + /var/cache/ntfy/ +} + +reload() { + ebegin "Reloading $RC_SVCNAME's configuration" + start-stop-daemon --signal SIGHUP --pidfile "${pidfile}" + eend $? "Failed to reload $RC_SVCNAME's configuration" +} diff --git a/www-apps/ntfy/ntfy-2.23.0.ebuild b/www-apps/ntfy/ntfy-2.23.0.ebuild new file mode 100644 index 0000000..d47681f --- /dev/null +++ b/www-apps/ntfy/ntfy-2.23.0.ebuild @@ -0,0 +1,54 @@ +# Copyright 1999-2026 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit systemd + +DESCRIPTION="Send push notifications to your phone or desktop using PUT/POST" +HOMEPAGE="https://ntfy.sh/" +IUSE="server" +SRC_URI=" + amd64? ( https://github.com/binwiederhier/ntfy/releases/download/v${PV}/ntfy_${PV}_linux_amd64.tar.gz ) + " +RESTRICT="mirror strip bindist" + +S=${WORKDIR}/ntfy_${PV}_linux_amd64 +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64" + +DEPEND=" +" + +RDEPEND=" + ${DEPEND} + acct-group/ntfy + acct-user/ntfy +" + +DOCS=( README.md ) + +src_prepare() { + default + + sed -i -e "s!# listen-http: \":80\"!listen-http: \"[::1]:8778\"!" server/server.yml || die +} + + +src_install() { + default + dobin ntfy + keepdir /etc/ntfy + insinto /etc/ntfy + doins client/client.yml + systemd_dounit client/ntfy-client.service + systemd_douserunit client/user/ntfy-client.service + newinitd "${FILESDIR}/client.initd" ntfy-client + + if use server ; then + doins server/server.yml + systemd_dounit server/ntfy.service + newinitd "${FILESDIR}/server.initd" ntfy + fi +}