diff --git a/config_example.toml b/config_example.toml index eb31c9a..55a3f87 100644 --- a/config_example.toml +++ b/config_example.toml @@ -23,7 +23,7 @@ webroot = "/var/www/html/meshviewer" enable = true # state-version of nodes.json to store cached data, # these is the directly collected respondd data -state_path = "/var/lib/collector/state.json" +state_path = "/var/lib/yanic/state.json" # Export nodes and graph periodically save_interval = "5s" diff --git a/contrib/packages/archlinux/.gitignore b/contrib/packages/archlinux/.gitignore new file mode 100644 index 0000000..bbd571a --- /dev/null +++ b/contrib/packages/archlinux/.gitignore @@ -0,0 +1,3 @@ +pkg/ +src/ +yanic*.pkg.tar diff --git a/contrib/packages/archlinux/PKGBUILD b/contrib/packages/archlinux/PKGBUILD new file mode 100644 index 0000000..8411816 --- /dev/null +++ b/contrib/packages/archlinux/PKGBUILD @@ -0,0 +1,37 @@ +# $Id$ +# Maintainer Geno + +pkgname=yanic +pkgver=0.1 +pkgrel=1 +pkgdesc='Yet an nother node info collector' +url='https://github.com/FreifunkBremen/yanic' +arch=('x86_64' 'i686') +makedepends=('git' 'go') +backup=("etc/yanic.conf") +source=("yanic.conf" + "yanic.service") +md5sums=('SKIP' + 'SKIP') + +install='yanic.install' + +prepare () { + msg2 "patch config to default http" + sed -e 's/\/var\/www\/html\//\/srv\/http\//g' yanic.conf > yanic-tmp.conf + sed -e 's/\/opt\/go\/bin/\/usr\/bin/g' yanic.service > yanic-tmp.service +} + +build() { + msg2 "GOPATH setup" + export GOPATH="$srcdir/gopath" + export PATH+=":$GOPATH/bin" + go get -v -u github.com/FreifunkBremen/yanic/cmd/... +} + +package() { + install -Dm644 yanic-tmp.conf "$pkgdir/etc/yanic.conf" + install -Dm644 yanic-tmp.service "$pkgdir/usr/lib/systemd/system/yanic.service" + install -Dsm755 "$GOPATH/bin/yanic" "$pkgdir/usr/bin/yanic" + install -Dsm755 "$GOPATH/bin/yanic-query" "$pkgdir/usr/bin/yanic-query" +} diff --git a/contrib/packages/archlinux/yanic.conf b/contrib/packages/archlinux/yanic.conf new file mode 120000 index 0000000..15d13c1 --- /dev/null +++ b/contrib/packages/archlinux/yanic.conf @@ -0,0 +1 @@ +../../../config_example.toml \ No newline at end of file diff --git a/contrib/packages/archlinux/yanic.install b/contrib/packages/archlinux/yanic.install new file mode 100644 index 0000000..9b8d14f --- /dev/null +++ b/contrib/packages/archlinux/yanic.install @@ -0,0 +1,13 @@ +post_install() { + getent group yanic >/dev/null || groupadd yanic + getent passwd yanic >/dev/null || useradd -d /var/lib/yanic -g yanic -r -M -s /bin/false yanic + + mkdir -p /srv/http/meshviewer/data /var/lib/yanic + chown yanic:yanic /var/lib/yanic /etc/yanic.conf + chown yanic:http /srv/http/meshviewer/data + chown http:http /srv/http/meshviewer +} + +post_upgrade() { + systemctl daemon-reload +} diff --git a/contrib/packages/archlinux/yanic.service b/contrib/packages/archlinux/yanic.service new file mode 120000 index 0000000..0a95c22 --- /dev/null +++ b/contrib/packages/archlinux/yanic.service @@ -0,0 +1 @@ +../../init/linux-systemd/yanic.service \ No newline at end of file