blob: ce68be18376a7912514293c99404bbc0dd5620c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# Maintainer: Iván Zaera Avellón <ivan dot zaera at protonmail dot com>
pkgname=owntracks-recorder
pkgver=0.9.8
pkgrel=2
pkgdesc='Lightweight program for storing and accessing location data published via MQTT (or HTTP) by the OwnTracks apps.'
arch=('i686' 'pentium4' 'x86_64')
url='https://github.com/owntracks/recorder'
license=('GPL')
depends=(
'curl'
'libconfig'
'libsodium'
'lmdb'
'lua'
'mosquitto'
)
makedepends=(
'coreutils'
'curl'
'libconfig'
'libsodium'
'lua'
'mosquitto'
)
backup=(
'etc/owntracks-recorder.conf'
)
install='install.sh'
source=(
"$pkgname-$pkgver.tar.gz::https://github.com/owntracks/recorder/archive/refs/tags/$pkgver.tar.gz"
)
sha256sums=("d16f6fcd98a00862253dafc32faea80bdf3b35dc7d337bc349c9f23cf90e2ecd")
build() {
cd "${srcdir}/recorder-${pkgver}"
cp config.mk.in config.mk
sed -i 's#INSTALLDIR = /usr/local#INSTALLDIR = /usr#g' config.mk
sed -i 's#WITH_LUA ?= no#WITH_LUA ?= yes#g' config.mk
sed -i 's#WITH_ENCRYPT ?= no#WITH_ENCRYPT ?= yes#g' config.mk
sed -i 's#STORAGEDEFAULT = /var/spool/owntracks/recorder/store#STORAGEDEFAULT = /var/lib/owntracks-recorder#g' config.mk
sed -i 's#DOCROOT = /var/spool/owntracks/recorder/htdocs#DOCROOT = /usr/share/webapps/owntracks-recorder#g' config.mk
sed -i 's#CONFIGFILE = /etc/default/ot-recorder#CONFIGFILE = /etc/owntracks-recorder.conf#g' config.mk
make
}
package() {
cd "${srcdir}/recorder-${pkgver}"
# Make installation
DESTDIR="${pkgdir}" make install
# Copy systemd service file
install -D -m644 etc/ot-recorder.service "${pkgdir}/usr/lib/systemd/system/owntracks-recorder.service"
cd "${pkgdir}"
# Move ot-recorder out of /usr/sbin
mkdir -p usr/bin
mv 'usr/sbin/ot-recorder' usr/bin/ot-recorder
rm -rf usr/sbin
# Make systemd create ot-recorder user
mkdir -p usr/lib/sysusers.d
echo 'u ot-recorder - "OwnTracks Recorder"' > usr/lib/sysusers.d/owntracks-recorder.conf
# Configure file/folder permissions
mkdir -p usr/lib/tmpfiles.d
echo 'd /var/lib/owntracks-recorder 0750 ot-recorder ot-recorder' > usr/lib/tmpfiles.d/owntracks-recorder.conf
echo 'Z /var/lib/owntracks-recorder 0750 ot-recorder ot-recorder' >> usr/lib/tmpfiles.d/owntracks-recorder.conf
echo 'z /etc/owntracks-recorder.conf 0640 root ot-recorder' >> usr/lib/tmpfiles.d/owntracks-recorder.conf
rm -rf var
# Tune owntracks-recorder.conf
sed -i 's#OTR_STORAGEDIR="/var/spool/owntracks/recorder/store"#OTR_STORAGEDIR="/var/lib/owntracks-recorder"#g' etc/owntracks-recorder.conf
sed -i 's%# OTR_PORT=1883%OTR_PORT=0%g' etc/owntracks-recorder.conf
# Tune owntracks-recorder.service
sed -i 's%# /etc/systemd/system/ot-recorder.service%%g' usr/lib/systemd/system/owntracks-recorder.service
sed -i 's#ExecStartPre=/bin/sleep 15#Environment="OTR_LMDBSIZE=104857600"#g' usr/lib/systemd/system/owntracks-recorder.service
sed -i 's#User=owntracks#User=ot-recorder#g' usr/lib/systemd/system/owntracks-recorder.service
sed -i 's#WorkingDirectory=/#WorkingDirectory=/var/lib/owntracks-recorder#g' usr/lib/systemd/system/owntracks-recorder.service
}
|