summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Vuillard2016-09-15 23:59:48 +0200
committerArthur Vuillard2016-09-15 23:59:48 +0200
commit6d9fa3a8a6e9082f15117230aae55db75000ce08 (patch)
tree3396a76261dd5902c1779227185063e71d17ebad
parent1bedd59b93148eb54783ff85aa28d2e81c157ab0 (diff)
downloadaur-6d9fa3a8a6e9082f15117230aae55db75000ce08.tar.gz
install as a service
-rw-r--r--.SRCINFO1
-rw-r--r--.gitignore3
-rw-r--r--PKGBUILD10
-rw-r--r--sysusers.conf1
-rw-r--r--watchghost.install19
-rw-r--r--watchghost.service13
6 files changed, 45 insertions, 2 deletions
diff --git a/.SRCINFO b/.SRCINFO
index d66d74db936..20898b3c1d6 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -3,6 +3,7 @@ pkgbase = watchghost-git
pkgver = 0.1.0.git_99.0005a9e
pkgrel = 1
url = https://gitlab.com/localg-host/watchghost/
+ install = watchghost.install
arch = any
license = AGPLv3
makedepends = python-setuptools
diff --git a/.gitignore b/.gitignore
index 87b64657ff3..86a380d79a5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,6 @@
!PKGBUILD
!.SRCINFO
!.gitignore
+!sysusers.conf
+!watchghost.install
+!watchghost.service
diff --git a/PKGBUILD b/PKGBUILD
index e80d92258ec..68095ce3d6a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -11,6 +11,8 @@ license=('AGPLv3')
depends=('python-tornado' 'python-aioftp')
makedepends=('python-setuptools')
source=('git+https://gitlab.com/localg-host/watchghost.git')
+sha256sums=('SKIP')
+install=watchghost.install
pkgver(){
cd $srcdir/$name
@@ -22,7 +24,11 @@ package() {
cd "$srcdir/$name"
python3 setup.py build
python3 setup.py install --prefix=/usr --root="${pkgdir}"
-}
-sha256sums=('SKIP')
+ install -D $startdir/sysusers.conf $pkgdir/usr/lib/sysusers.d/watchghost.conf
+ install -D $startdir/watchghost.service $pkgdir/usr/lib/systemd/system/watchghost.service
+ for filename in groups loggers servers watchers ; do
+ install -D $srcdir/watchghost/watchghost/etc/$filename $pkgdir/etc/watchghost/$filename
+ done
+}
diff --git a/sysusers.conf b/sysusers.conf
new file mode 100644
index 00000000000..dca275a65aa
--- /dev/null
+++ b/sysusers.conf
@@ -0,0 +1 @@
+u watchghost - -
diff --git a/watchghost.install b/watchghost.install
new file mode 100644
index 00000000000..f03d211ce3d
--- /dev/null
+++ b/watchghost.install
@@ -0,0 +1,19 @@
+post_install() {
+ systemd-sysusers watchghost.conf
+ systemctl daemon-reload
+}
+
+post_upgrade() {
+ systemd-sysusers watchghost.conf
+ systemctl daemon-reload
+}
+
+pre_remove() {
+ systemctl stop watchghost.service;
+ systemctl disable watchghost.service;
+}
+
+post_remove() {
+ systemctl daemon-reload
+}
+
diff --git a/watchghost.service b/watchghost.service
new file mode 100644
index 00000000000..1d01d4e7ad6
--- /dev/null
+++ b/watchghost.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Watchghost daemon
+After=network.target
+
+[Service]
+Type=simple
+User=watchghost
+Group=watchghost
+ExecStart=/usr/bin/watchghost-server.py --config=/etc/watchghost
+
+[Install]
+WantedBy=multi-user.target
+