summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5a6a6a539bcdc52dadad1d55a78e91118d2996b8 (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
# Maintainer: Wolfgang Gehrhardt <gehwolf at freenet dot de>

pkgname=elos
pkgver=1.0.0
pkgrel=1
pkgdesc="An event logging system"
arch=('x86_64')
url="https://github.com/Elektrobit/elos"
license=('MIT')
depends=('glibc' 'safu' 'samconf' 'libmnl' 'sqlite' 'json-c')
makedepends=('cmake' 'jq' 'git')
install='elos.install'

source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/$pkgname-$pkgver.tar.gz")
backup=('etc/elos/elosd.json')

build() {
  cd "$pkgname-$pkgname-$pkgver"
  cmake -B build \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_BUILD_TYPE=Release \
	-DENABLE_GIT_VERSION=on \
	-DELOS_BUILD_DEFAULTS=off \
	-DELOS_DAEMON=on \
	-DELOS_COMMON=on \
	-DELOS_LIBRARY=on \
	-DELOS_PLUGINS=on \
	-DELOS_PLUGIN_LIBRARY=on \
	-DELOSD_EVENTLOGGING_BACKEND_SQL=on \
	-DELOS_TOOLS=on \
	.
  make -C build
}

_editConfig() {
  _CONFIG=$(jq "$1" "$pkgdir/etc/elos/elosd.json")
  echo "${_CONFIG}" > "$pkgdir/etc/elos/elosd.json"
}

package() {
  cd "$pkgname-$pkgname-$pkgver"
  make -C build DESTDIR="$pkgdir/" install

  install -Dm644 'LICENSE' "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  mv "$pkgdir/usr/etc/elos/elosd.json" "$pkgdir/etc/elos/"

  # No need to override plugin search path, use compile default /usr/lib/elos/
  _editConfig 'del(.root.elos.ClientInputs.PluginSearchPath)'
  _editConfig 'del(.root.elos.EventLogging.PluginSearchPath)'
  _editConfig 'del(.root.elos.Scanner.PluginSearchPath)'
  _editConfig 'del(.root.elos.Scanner.Path)'

  # Don't need demo dummy storage backend
  _editConfig 'del(.root.elos.EventLogging.Plugins.Dummy)'

  # Don't need DLT storage backend
  _editConfig 'del(.root.elos.EventLogging.Plugins.DLT)'

  # log everything with json backend
  _editConfig '.root.elos.EventLogging.Plugins.JsonBackend.Filter = ["1 1 EQ"]'

  # Set log storage path
  _editConfig '.root.elos.EventLogging.Plugins.JsonBackend.Config.StoragePath = "/var/log/elos/elos.json"'

  # Default log level is Debug , reduce verbosity
  _editConfig '.root.elos.LogLevel = "ERROR"'

  # set default syslog mapping rule
  _editConfig '.root.elos.Scanner.Plugins.SyslogScanner.Config.MappingRules.MessageCodes = {"1003":"1 1 EQ"}'

  # elos currently can't forward syslog messages on the syslog socket, thus
  # don't acquire /dev/log to not conflict with other syslog daemons
  _editConfig '.root.elos.Scanner.Plugins.SyslogScanner.Config.SyslogPath = "/run/elos/dev-log"'
}
sha256sums=('3f0eacb426c146b1de9703cdf7164ad85e000fcf85fd9ccec1efa986413cb1a5')