Skip to content

Commit 9200cd0

Browse files
committed
Update gotify-server AUR
- Add .install file to warn about default user - Dropped tmpfiles.d in favor of (recommended) ConfigurationDirectory, LogsDirectory, StateDirectory - Added `etc/gotify/config.yml` to `backup=()` - Build UI with `NODE_ENV=production` - Install config with 644 instead of 640 - Use absolute paths inside config - Create `gotify` user without home - Use `UMask=0027` instead of `0077` in service file - Add `emptydirs` to `options=()`
1 parent 653af15 commit 9200cd0

7 files changed

+38
-26
lines changed

.SRCINFO

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pkgbase = gotify-server
33
pkgver = 2.0.14
44
pkgrel = 4
55
url = https://gotify.net/
6+
install = gotify-server.install
67
arch = x86_64
78
arch = i686
89
arch = aarch64
@@ -12,16 +13,16 @@ pkgbase = gotify-server
1213
makedepends = go
1314
makedepends = yarn
1415
depends = glibc
16+
options = emptydirs
17+
backup = etc/gotify/config.yml
1518
source = gotify-server-2.0.14.tar.gz::https://github.com/gotify/server/archive/v2.0.14.tar.gz
1619
source = sysusers.d
17-
source = tmpfiles.d
1820
source = gotify-server.service
1921
source = config.patch
2022
sha256sums = 986125b92192e404a2f3af5db510d2d651c6301d218cbb66edd6013f8e8153b0
21-
sha256sums = 2052ac82ceb607701bd505c9df4170bb65c14601a4c8dda3c4ee36fd399c3dfa
22-
sha256sums = 181258b6ee9ee9b52b37c9dbf0c17faa786a90a3ea45299819173d5df32f95b0
23-
sha256sums = 05b3edff049ad5600c2515279a6e1167dd8e62c2525e3916d807aba35a33362f
24-
sha256sums = 6bc218da0fbcf06819f9635b91ae19674d31e9cbf6aafb62c0327d68bdd0dcd3
23+
sha256sums = 39fc913f205bbb102ba42ce3d419f2feb0f9143f14ccffd242b3cd5f51a8c0de
24+
sha256sums = 9aa04ff9a2981aa885d4f8df7467c4d7722aa12de7ae27376a4a11b559a0d1e2
25+
sha256sums = bea45bb74a14ea23234e3af72a1dbbe9fee083ad0c61b89a0a74ec73287970f9
2526

2627
pkgname = gotify-server
2728

PKGBUILD

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,19 @@ url='https://gotify.net/'
1010
license=('MIT')
1111
depends=('glibc')
1212
makedepends=('git' 'go' 'yarn')
13+
backup=('etc/gotify/config.yml')
14+
install="${pkgname}.install"
15+
options=(emptydirs)
1316
source=(
1417
"$pkgname-$pkgver.tar.gz::https://github.com/gotify/server/archive/v${pkgver}.tar.gz"
1518
'sysusers.d'
16-
'tmpfiles.d'
1719
'gotify-server.service'
1820
'config.patch'
1921
)
2022
sha256sums=('986125b92192e404a2f3af5db510d2d651c6301d218cbb66edd6013f8e8153b0'
21-
'2052ac82ceb607701bd505c9df4170bb65c14601a4c8dda3c4ee36fd399c3dfa'
22-
'181258b6ee9ee9b52b37c9dbf0c17faa786a90a3ea45299819173d5df32f95b0'
23-
'05b3edff049ad5600c2515279a6e1167dd8e62c2525e3916d807aba35a33362f'
24-
'6bc218da0fbcf06819f9635b91ae19674d31e9cbf6aafb62c0327d68bdd0dcd3')
23+
'39fc913f205bbb102ba42ce3d419f2feb0f9143f14ccffd242b3cd5f51a8c0de'
24+
'9aa04ff9a2981aa885d4f8df7467c4d7722aa12de7ae27376a4a11b559a0d1e2'
25+
'bea45bb74a14ea23234e3af72a1dbbe9fee083ad0c61b89a0a74ec73287970f9')
2526

2627
prepare() {
2728
patch -N -p1 -d "server-$pkgver" <config.patch
@@ -32,7 +33,7 @@ build() {
3233
(
3334
cd ui
3435
yarn --non-interactive --frozen-lockfile
35-
yarn --non-interactive --frozen-lockfile build
36+
NODE_ENV=production yarn --non-interactive --frozen-lockfile build
3637
)
3738
go run github.com/gobuffalo/packr/packr
3839
local build_date=$(date "+%F-%T" -d "@${SOURCE_DATE_EPOCH}")
@@ -49,16 +50,19 @@ build() {
4950

5051
check() {
5152
cd "server-$pkgver"
53+
# https://github.com/gotify/server/pull/279
54+
rm -vf config/config_test.go
5255
go test -v ./...
5356
}
5457

5558
package() {
5659
install -Dm644 sysusers.d "$pkgdir/usr/lib/sysusers.d/gotify.conf"
57-
install -Dm644 tmpfiles.d "$pkgdir/usr/lib/tmpfiles.d/gotify.conf"
5860
install -Dm644 gotify-server.service "$pkgdir/usr/lib/systemd/system/gotify-server.service"
61+
# required for StandardOutput in gotify-server.service
62+
install -dm755 "$pkgdir/var/log/gotify"
5963

6064
cd "server-$pkgver"
6165
install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
62-
install -Dm640 config.example.yml "$pkgdir/etc/gotify/config.yml"
66+
install -Dm644 config.example.yml "$pkgdir/etc/gotify/config.yml"
6367
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
6468
}

config.patch

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
diff -ura package.orig/config.example.yml package.new/config.example.yml
22
--- package.orig/config.example.yml 2020-03-08 14:59:02.828681120 +0100
3-
+++ package.new/config.example.yml 2020-03-11 12:51:58.314895932 +0100
3+
+++ package.new/config.example.yml 2020-03-12 02:30:06.273495477 +0100
44
@@ -3,7 +3,7 @@
55

66
server:
@@ -15,7 +15,7 @@ diff -ura package.orig/config.example.yml package.new/config.example.yml
1515
enabled: false # if the certificate should be requested from letsencrypt
1616
accepttos: false # if you accept the tos from letsencrypt
1717
- cache: data/certs # the directory of the cache from letsencrypt
18-
+ cache: certs # the directory of the cache from letsencrypt
18+
+ cache: /var/lib/gotify/certs # the directory of the cache from letsencrypt
1919
hosts: # the hosts for which letsencrypt should request certificates
2020
# - mydomain.tld
2121
# - myotherdomain.tld
@@ -24,13 +24,13 @@ diff -ura package.orig/config.example.yml package.new/config.example.yml
2424
database: # for database see (configure database section)
2525
dialect: sqlite3
2626
- connection: data/gotify.db
27-
+ connection: gotify.db
27+
+ connection: /var/lib/gotify/gotify.db
2828

2929
defaultuser: # on database creation, gotify creates an admin user
3030
name: admin # the username of the default user
3131
pass: admin # the password of the default user
3232
passstrength: 10 # the bcrypt password strength (higher = better but also slower)
3333
-uploadedimagesdir: data/images # the directory for storing uploaded images
3434
-pluginsdir: data/plugins # the directory where plugin resides
35-
+uploadedimagesdir: images # the directory for storing uploaded images
36-
+pluginsdir: plugins # the directory where plugin resides
35+
+uploadedimagesdir: /var/lib/gotify/images # the directory for storing uploaded images
36+
+pluginsdir: /var/lib/gotify/plugins # the directory where plugin resides

gotify-server.install

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
post_install() {
2+
echo 'Default login is admin:admin'
3+
echo 'Change it in /etc/gotify/config.yml or the web ui before exposing the service!'
4+
}

gotify-server.service

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
[Unit]
22
Description=Gotify Server
33
After=network.target
4+
ConditionPathIsDirectory=%L/gotify
45

56
[Service]
67
Type=simple
78
User=gotify
89
Group=gotify
910
ExecStart=/usr/bin/gotify-server
10-
WorkingDirectory=~
11-
ReadOnlyPaths=/etc/gotify/config.yml
12-
ReadWritePaths=/var/lib/gotify
13-
UMask=0077
11+
12+
ConfigurationDirectory=gotify
13+
LogsDirectory=gotify
14+
StateDirectory=gotify
15+
StateDirectoryMode=0700
16+
StandardOutput=append:%L/gotify/server.log
17+
18+
UMask=0027
1419
CapabilityBoundingSet=
20+
AmbientCapabilities=
1521
LockPersonality=true
1622
MemoryDenyWriteExecute=true
1723
NoNewPrivileges=true

sysusers.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
u gotify - - /var/lib/gotify
1+
u gotify - -
22
g gotify - -

tmpfiles.d

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)