summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorbuckket2021-01-12 01:34:34 +0100
committerbuckket2021-01-12 01:34:34 +0100
commit271cc55ca2a8cd268c56abcc2f71e26773fc4819 (patch)
treeb940833b771845db0088e564589888d8117724a5
parentfbb2e75fb98711783d158e12e8c389d3d7ead5a3 (diff)
downloadaur-271cc55ca2a8cd268c56abcc2f71e26773fc4819.tar.gz
Refactor package, same as non-git version
-rw-r--r--.SRCINFO14
-rw-r--r--PKGBUILD36
-rw-r--r--zigbee2mqtt.install6
-rw-r--r--zigbee2mqtt.service4
-rw-r--r--zigbee2mqtt.sysusers3
-rw-r--r--zigbee2mqtt.tmpfiles5
6 files changed, 44 insertions, 24 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 7109100d0350..a0558902b279 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,8 +1,9 @@
pkgbase = zigbee2mqtt-git
pkgdesc = A Zigbee to MQTT bridge
pkgver = 1.12.0.r0.g840b9d9
- pkgrel = 3
+ pkgrel = 4
url = https://www.zigbee2mqtt.io
+ install = zigbee2mqtt.install
arch = x86_64
arch = arm
arch = armv6h
@@ -10,21 +11,22 @@ pkgbase = zigbee2mqtt-git
arch = aarch64
license = GPL3
makedepends = git
+ makedepends = npm
depends = nodejs>=10.0
- depends = npm
optdepends = cc-tool: To flash Texas Instruments CC2531 debugger
optdepends = mosquitto: MQTT broker
provides = zigbee2mqtt
conflicts = zigbee2mqtt
- backup = opt/zigbee2mqtt/data/configuration.yaml
+ options = !strip
+ backup = etc/zigbee2mqtt/configuration.yaml
source = zigbee2mqtt::git+https://github.com/Koenkk/zigbee2mqtt.git
source = zigbee2mqtt.service
source = zigbee2mqtt.sysusers
source = zigbee2mqtt.tmpfiles
sha256sums = SKIP
- sha256sums = 831ce970669d29ba2db208bec8245c97e80540981dd23276bba10a9b7b699e1b
- sha256sums = bf3e49cfb86df460b4db16b280839dc7f0c73fbfd29ea6d86040f711606abf65
- sha256sums = 5861e6e25350b32fc81cf1a43802470e8ff033a019cba4d28b3bd48c6cb5ddf6
+ sha256sums = 36fdca9c274fc143a85cc57d70a36e0ec9455cf86b85d0690ccf0090ee8d682d
+ sha256sums = 3a86716e9036e97d885e9b5f37c7f87d9c2872435e4acf9fc4c9157264cf387b
+ sha256sums = 8f0fbe06c8d6e8fdf37feb31f244930025d76785451f9049fd90fe6e23c259f6
pkgname = zigbee2mqtt-git
diff --git a/PKGBUILD b/PKGBUILD
index 3b6d79c43911..b412324dc15f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,15 +3,15 @@
_pkgname=zigbee2mqtt
pkgname=zigbee2mqtt-git
pkgver=1.12.0.r0.g840b9d9
-pkgrel=3
+pkgrel=4
pkgdesc='A Zigbee to MQTT bridge'
arch=('x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64')
url='https://www.zigbee2mqtt.io'
license=('GPL3')
-depends=('nodejs>=10.0' 'npm')
+depends=('nodejs>=10.0')
conflicts=('zigbee2mqtt')
provides=('zigbee2mqtt')
-makedepends=('git')
+makedepends=('git' 'npm')
optdepends=(
'cc-tool: To flash Texas Instruments CC2531 debugger'
'mosquitto: MQTT broker')
@@ -21,10 +21,12 @@ source=(
'zigbee2mqtt.sysusers'
'zigbee2mqtt.tmpfiles')
sha256sums=('SKIP'
- '831ce970669d29ba2db208bec8245c97e80540981dd23276bba10a9b7b699e1b'
- 'bf3e49cfb86df460b4db16b280839dc7f0c73fbfd29ea6d86040f711606abf65'
- '5861e6e25350b32fc81cf1a43802470e8ff033a019cba4d28b3bd48c6cb5ddf6')
-backup=('opt/zigbee2mqtt/data/configuration.yaml')
+ '36fdca9c274fc143a85cc57d70a36e0ec9455cf86b85d0690ccf0090ee8d682d'
+ '3a86716e9036e97d885e9b5f37c7f87d9c2872435e4acf9fc4c9157264cf387b'
+ '8f0fbe06c8d6e8fdf37feb31f244930025d76785451f9049fd90fe6e23c259f6')
+backup=('etc/zigbee2mqtt/configuration.yaml')
+install='zigbee2mqtt.install'
+options=('!strip')
pkgver() {
cd "${_pkgname}"
@@ -32,12 +34,18 @@ pkgver() {
}
package() {
- cd "${_pkgname}"
- npm install --cache "${srcdir}/npm-cache" --user root
- install -d -m 650 "${pkgdir}/opt/${_pkgname}"
- cp -dpr --no-preserve=ownership "${srcdir}/${_pkgname}/" "${pkgdir}/opt/"
- install -Dm644 "${srcdir}/${_pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${_pkgname}.service"
- install -Dm644 "${srcdir}/${_pkgname}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${_pkgname}.conf"
- install -Dm644 "${srcdir}/${_pkgname}.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${_pkgname}.conf"
+ npm install -g --user root --prefix "${pkgdir}/usr" --cache "${srcdir}/npm-cache" "${srcdir}/${pkgver}.tar.gz"
+
+ find "${pkgdir}/usr" -type d -exec chmod 755 {} +
+ chown -R root:root "${pkgdir}"
+
+ find "${pkgdir}" -name package.json -print0 | xargs -r -0 sed -i '/_where/d'
+
+ cd "${pkgname}-${pkgver}"
+ install -Dm644 data/configuration.yaml "${pkgdir}/etc/${pkgname}/configuration.yaml"
+
+ install -Dm644 "${srcdir}/${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
+ install -Dm644 "${srcdir}/${pkgname}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
+ install -Dm644 "${srcdir}/${pkgname}.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
}
diff --git a/zigbee2mqtt.install b/zigbee2mqtt.install
new file mode 100644
index 000000000000..9cc661d565e7
--- /dev/null
+++ b/zigbee2mqtt.install
@@ -0,0 +1,6 @@
+post_upgrade() {
+ echo "The configuration file for zigbee2mqtt is now located in /etc/zigbee2mqtt"
+ echo "Please move your old configuration file if you upgraded from a previous version of this package:"
+ echo "mv /opt/zigbee2mqtt/data/configuration.yaml.pacsave /etc/zigbee2mqtt/configuration.yaml"
+}
+
diff --git a/zigbee2mqtt.service b/zigbee2mqtt.service
index 0dd6e825f952..a0aed1e61a21 100644
--- a/zigbee2mqtt.service
+++ b/zigbee2mqtt.service
@@ -3,8 +3,8 @@ Description=zigbee2mqtt
After=network.target
[Service]
-ExecStart=/usr/bin/npm start
-WorkingDirectory=/opt/zigbee2mqtt
+ExecStart=node /usr/lib/node_modules/zigbee2mqtt/index.js
+Environment=ZIGBEE2MQTT_DATA=/var/lib/zigbee2mqtt
StandardOutput=inherit
StandardError=inherit
Restart=always
diff --git a/zigbee2mqtt.sysusers b/zigbee2mqtt.sysusers
index ba2e76d8965b..44c4d49112cc 100644
--- a/zigbee2mqtt.sysusers
+++ b/zigbee2mqtt.sysusers
@@ -1 +1,2 @@
-u zigbee2mqtt - "zigbee2mqtt service user" /opt/zigbee2mqtt
+u zigbee2mqtt - "zigbee2mqtt service user"
+m zigbee2mqtt uucp
diff --git a/zigbee2mqtt.tmpfiles b/zigbee2mqtt.tmpfiles
index 8db6f606ef4b..917b374168ca 100644
--- a/zigbee2mqtt.tmpfiles
+++ b/zigbee2mqtt.tmpfiles
@@ -1 +1,4 @@
-d /opt/zigbee2mqtt/data 0755 zigbee2mqtt zigbee2mqtt -
+d /var/lib/zigbee2mqtt 0750 zigbee2mqtt zigbee2mqtt
+z /etc/zigbee2mqtt/configuration.yaml 0640 zigbee2mqtt zigbee2mqtt
+L /var/lib/zigbee2mqtt/configuration.yaml - - - - /etc/zigbee2mqtt/configuration.yaml
+