From 092ddc01587bd01e9da76c54fe3c3e1b248232ff Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Sat, 31 Dec 2022 16:15:19 -0500 Subject: [PATCH] New package: ntfy-2.0.0 --- srcpkgs/ntfy/files/ntfy-server/run | 3 +++ srcpkgs/ntfy/patches/config.patch | 31 ++++++++++++++++++++++ srcpkgs/ntfy/patches/no_short_commit.patch | 13 +++++++++ srcpkgs/ntfy/template | 30 +++++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 srcpkgs/ntfy/files/ntfy-server/run create mode 100644 srcpkgs/ntfy/patches/config.patch create mode 100644 srcpkgs/ntfy/patches/no_short_commit.patch create mode 100644 srcpkgs/ntfy/template diff --git a/srcpkgs/ntfy/files/ntfy-server/run b/srcpkgs/ntfy/files/ntfy-server/run new file mode 100644 index 000000000000..26e9f7928163 --- /dev/null +++ b/srcpkgs/ntfy/files/ntfy-server/run @@ -0,0 +1,3 @@ +#!/bin/sh +exec 2>&1 +exec chpst -u _ntfy:_ntfy ntfy serve diff --git a/srcpkgs/ntfy/patches/config.patch b/srcpkgs/ntfy/patches/config.patch new file mode 100644 index 000000000000..ea868b694646 --- /dev/null +++ b/srcpkgs/ntfy/patches/config.patch @@ -0,0 +1,31 @@ +diff --git a/server/server.yml b/server/server.yml +index 1b26899..5de6ac1 100644 +--- a/server/server.yml ++++ b/server/server.yml +@@ -36,7 +36,7 @@ + # If set, also publish messages to a Firebase Cloud Messaging (FCM) topic for your app. + # This is optional and only required to save battery when using the Android app. + # +-# firebase-key-file: ++# firebase-key-file: /var/lib/ntfy/firebase.key + + # If "cache-file" is set, messages are cached in a local SQLite database instead of only in-memory. + # This allows for service restarts without losing messages in support of the since= parameter. +@@ -68,7 +68,7 @@ + # If you are running ntfy with systemd, make sure this cache file is owned by the + # ntfy user and group by running: chown ntfy.ntfy . + # +-# cache-file: ++# cache-file: /var/lib/ntfy/cache.db + # cache-duration: "12h" + # cache-startup-queries: + # cache-batch-size: 0 +@@ -89,7 +89,7 @@ + # If you are running ntfy with systemd, make sure this user database file is owned by the + # ntfy user and group by running: chown ntfy.ntfy . + # +-# auth-file: ++# auth-file: /var/lib/ntfy/user.db + # auth-default-access: "read-write" + + # If set, the X-Forwarded-For header is used to determine the visitor IP address diff --git a/srcpkgs/ntfy/patches/no_short_commit.patch b/srcpkgs/ntfy/patches/no_short_commit.patch new file mode 100644 index 000000000000..27fe46e58389 --- /dev/null +++ b/srcpkgs/ntfy/patches/no_short_commit.patch @@ -0,0 +1,13 @@ +diff --git a/main.go b/main.go +index 5b1428d..2f7087a 100644 +--- a/main.go ++++ b/main.go +@@ -24,7 +24,7 @@ the Matrix room (https://matrix.to/#/#ntfy:matrix.org). + + ntfy %s (%s), runtime %s, built at %s + Copyright (C) 2022 Philipp C. Heckel, licensed under Apache License 2.0 & GPLv2 +-`, version, commit[:7], runtime.Version(), date) ++`, version, commit, runtime.Version(), date) + + app := cmd.New() + app.Version = version diff --git a/srcpkgs/ntfy/template b/srcpkgs/ntfy/template new file mode 100644 index 000000000000..bb8a0d39d371 --- /dev/null +++ b/srcpkgs/ntfy/template @@ -0,0 +1,30 @@ +# Template file for 'ntfy' +pkgname=ntfy +version=2.0.0 +revision=1 +build_style=go +go_import_path="heckel.io/ntfy" +go_ldflags="-X main.version=${version} -X main.commit=v${version} + -X main.date=${SOURCE_DATE_EPOCH}" +hostmakedepends="nodejs" +short_desc="Send push notifications to your phone or desktop using PUT/POST" +maintainer="Joel Beckmeyer " +license="Apache-2.0,GPL-2.0-only" +homepage="https://ntfy.sh" +distfiles="https://github.com/binwiederhier/ntfy/archive/refs/tags/v${version}.tar.gz" +checksum=08bbb642efcc476e45c7168c2b475c3ad83e5bf2fb901c79fd2c6b76f3326a4a +system_accounts="_ntfy" +make_dirs="/var/lib/ntfy 0700 _ntfy _ntfy" +_ntfy_homedir="/var/lib/ntfy" +conf_files="/etc/ntfy/server.yml" + +pre_build() { + make web + mkdir -p dist/ntfy_linux_server server/docs + touch server/docs/index.html server/site/app.html +} + +post_install() { + vsv ntfy-server + vinstall server/server.yml 644 etc/ntfy +}