summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorZach Himsel2023-02-24 09:42:22 -0500
committerZach Himsel2023-02-24 09:42:22 -0500
commit891d77670b6e0027f305090f0176b192de367b0e (patch)
treedc7277d4ad9330068ce07a13343e7b0b5816349f
parent7d41e7095edc611d3a1cb6ea990e0910af5deeba (diff)
downloadaur-891d77670b6e0027f305090f0176b192de367b0e.tar.gz
Add user-level systemd unit
Also, add environment files in both units
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD7
-rw-r--r--hacompanion.service3
-rw-r--r--hacompanion.service-user11
4 files changed, 22 insertions, 5 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 283219644325..9d1d2ff78069 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = hacompanion
pkgdesc = Daemon that sends local hardware information to Home Assistant
pkgver = 1.0.7
- pkgrel = 1
+ pkgrel = 2
url = https://github.com/tobias-kuendig/hacompanion
arch = any
license = MIT
@@ -12,12 +12,14 @@ pkgbase = hacompanion
source = hacompanion::git+https://github.com/tobias-kuendig/hacompanion.git#tag=v1.0.7
source = hacompanion.install
source = hacompanion.service
+ source = hacompanion.service-user
source = hacompanion.sysusers
source = hacompanion.tmpfiles
source = 0001-Save-registration-file-to-var-lib-hacompanion.patch
sha256sums = SKIP
sha256sums = 8d0bdc24a666302edb64759dcc82ba10f70de2fa06e489cd663362907aaf7c92
- sha256sums = c23ba0d97c345eee311e0950e36309e88890245b978538fde3b85a734ad2cc4b
+ sha256sums = 85331900cd5457dfffbcc7e4ebfde5d2049ce38aae27b21eecbc9b06c31fc48c
+ sha256sums = c3bc5ae2d7ca5b53696c5d0a0e12799e344d5cf00a399cfe402ab3066eb8ca7b
sha256sums = a6cf94385c30eee6de74caa6b63a5ca6ebcbf9451a95bcff7765d9972434af5d
sha256sums = b4242c4051c71ea275376d8a753a36c9816a1bab08eed8205ce97b2d958a9b4b
sha256sums = ae0d021f4b08f36151ff5c0c2497b8ab55cf5f101e29100b04a2d8b39b90fe9d
diff --git a/PKGBUILD b/PKGBUILD
index f833ff8ee224..f5293c74fc8d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -8,7 +8,7 @@ url="https://github.com/${_reponame}"
license=('MIT')
pkgver=1.0.7
-pkgrel=1
+pkgrel=2
arch=('any')
conflicts=('hacompanion-git')
@@ -17,12 +17,14 @@ makedepends=('git' 'go')
source=("${_pkgname}::git+https://github.com/${_reponame}.git#tag=v${pkgver}"
"hacompanion.install"
"hacompanion.service"
+ "hacompanion.service-user"
"hacompanion.sysusers"
"hacompanion.tmpfiles"
"0001-Save-registration-file-to-var-lib-hacompanion.patch")
sha256sums=('SKIP'
'8d0bdc24a666302edb64759dcc82ba10f70de2fa06e489cd663362907aaf7c92'
- 'c23ba0d97c345eee311e0950e36309e88890245b978538fde3b85a734ad2cc4b'
+ '85331900cd5457dfffbcc7e4ebfde5d2049ce38aae27b21eecbc9b06c31fc48c'
+ 'c3bc5ae2d7ca5b53696c5d0a0e12799e344d5cf00a399cfe402ab3066eb8ca7b'
'a6cf94385c30eee6de74caa6b63a5ca6ebcbf9451a95bcff7765d9972434af5d'
'b4242c4051c71ea275376d8a753a36c9816a1bab08eed8205ce97b2d958a9b4b'
'ae0d021f4b08f36151ff5c0c2497b8ab55cf5f101e29100b04a2d8b39b90fe9d')
@@ -63,6 +65,7 @@ package() {
# service
install -D -m644 "${srcdir}/${_pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${_pkgname}.service"
+ install -D -m644 "${srcdir}/${_pkgname}.service-user" "${pkgdir}/usr/lib/systemd/user/${_pkgname}.service"
# systemd user and home directory
install -D -m644 "${srcdir}/${_pkgname}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${_pkgname}.conf"
diff --git a/hacompanion.service b/hacompanion.service
index 4465876f2d79..730ab0c37f44 100644
--- a/hacompanion.service
+++ b/hacompanion.service
@@ -6,7 +6,8 @@ After=network.target
[Service]
User=hacompanion
Group=hacompanion
-ExecStart=/usr/bin/hacompanion -config /etc/hacompanion/config.toml
+EnvironmentFile=%E/hacompanion/env
+ExecStart=/usr/bin/hacompanion -config %E/hacompanion/config.toml
Restart=on-failure
[Install]
diff --git a/hacompanion.service-user b/hacompanion.service-user
new file mode 100644
index 000000000000..9f9e4d92887b
--- /dev/null
+++ b/hacompanion.service-user
@@ -0,0 +1,11 @@
+[Unit]
+Description=Home Assistant Desktop Companion
+Documentation=https://github.com/tobias-kuendig/hacompanion
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/hacompanion -config %E/hacompanion/config.toml
+Restart=on-failure
+
+[Install]
+WantedBy=default.target