summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDct Mei2020-03-15 23:17:54 +0800
committerDct Mei2020-03-15 23:17:54 +0800
commit4bac3ad11fc317b76cc05a330c85f0622b378a36 (patch)
treec23cf48c823daf289ff07565e94427a0b46f7070
parent48c9ce6902ab04f63012f643ba1a3e8daaa5f984 (diff)
downloadaur-4bac3ad11fc317b76cc05a330c85f0622b378a36.tar.gz
add startup service file
-rw-r--r--.SRCINFO5
-rw-r--r--PKGBUILD18
-rw-r--r--geph-client.install7
-rw-r--r--geph-client.service13
4 files changed, 38 insertions, 5 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 921ab61dddd7..efa3a9984a59 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,15 +1,18 @@
pkgbase = geph-client
pkgdesc = A command-line Geph client
pkgver = 0.18.16
- pkgrel = 1
+ pkgrel = 2
url = https://github.com/geph-official/geph2
+ install = geph-client.install
arch = x86_64
groups = geph2
license = GPL3
makedepends = go-pie
depends = glibc
source = geph-client-0.18.16.tar.gz::https://github.com/geph-official/geph2/archive/v0.18.16.tar.gz
+ source = geph-client.service
sha512sums = 8493a98af3c04952ccba4b20d0a505e9e047f839d472161c0744a763ced78ebf7e34aebcbb317636d10d5547029362078bef431cb59c94fd38925bb69368d364
+ sha512sums = d23b669396f8bd6c99d78a478de233b211f4202812348dc2c78050ad2646870027a766a0bca51ead70b06947fb6dc49d646e462682e0d3fb685b3a00840d104a
pkgname = geph-client
diff --git a/PKGBUILD b/PKGBUILD
index a782aee4bfc5..796fa122cdc9 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,7 +2,7 @@
pkgname=geph-client
pkgver=0.18.16
-pkgrel=1
+pkgrel=2
pkgdesc='A command-line Geph client'
arch=('x86_64')
url="https://github.com/geph-official/geph2"
@@ -10,8 +10,11 @@ license=('GPL3')
groups=('geph2')
depends=('glibc')
makedepends=('go-pie')
-source=("$pkgname-$pkgver.tar.gz::https://github.com/geph-official/geph2/archive/v$pkgver.tar.gz")
-sha512sums=('8493a98af3c04952ccba4b20d0a505e9e047f839d472161c0744a763ced78ebf7e34aebcbb317636d10d5547029362078bef431cb59c94fd38925bb69368d364')
+install=$pkgname.install
+source=("$pkgname-$pkgver.tar.gz::https://github.com/geph-official/geph2/archive/v$pkgver.tar.gz"
+ "geph-client.service")
+sha512sums=('8493a98af3c04952ccba4b20d0a505e9e047f839d472161c0744a763ced78ebf7e34aebcbb317636d10d5547029362078bef431cb59c94fd38925bb69368d364'
+ 'd23b669396f8bd6c99d78a478de233b211f4202812348dc2c78050ad2646870027a766a0bca51ead70b06947fb6dc49d646e462682e0d3fb685b3a00840d104a')
build() {
cd "geph2-$pkgver/cmd/$pkgname"
@@ -20,5 +23,12 @@ build() {
package() {
cd "geph2-$pkgver/cmd/$pkgname"
- install -Dm 755 $pkgname "$pkgdir/usr/bin/$pkgname"
+ install -Dm 755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
+
+ install -d "$pkgdir/etc/geph2"
+ "$pkgdir/usr/bin/$pkgname" -dumpflags > "$pkgdir/etc/geph2/$pkgname.ini"
+
+ install -Dm 644 "$srcdir/$pkgname.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service"
+ sed 's/geph-client.ini/%i.ini/' "$srcdir/$pkgname.service" -i
+ install -Dm 644 "$srcdir/$pkgname.service" "$pkgdir/usr/lib/systemd/system/$pkgname@.service"
}
diff --git a/geph-client.install b/geph-client.install
new file mode 100644
index 000000000000..89a04fa6c96e
--- /dev/null
+++ b/geph-client.install
@@ -0,0 +1,7 @@
+post_install() {
+ setcap cap_net_bind_service+ep usr/bin/geph-client 2>/dev/null
+}
+
+post_upgrade() {
+ post_install "$1"
+}
diff --git a/geph-client.service b/geph-client.service
new file mode 100644
index 000000000000..f8034ee9100a
--- /dev/null
+++ b/geph-client.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Geph client Service
+After=network-online.target
+Wants=network-online.target
+
+[Service]
+Type=simple
+User=nobody
+CapabilityBoundingSet=CAP_NET_BIND_SERVICE
+ExecStart=/usr/bin/geph-client -config /etc/geph2/geph-client.ini
+
+[Install]
+WantedBy=multi-user.target