debmaker/ressources/zigbee2mqtt/zigbee2mqtt
2022-03-02 22:15:23 +01:00

39 lines
882 B
Bash
Executable file

#!/bin/bash
[ -e ./lib/function.sh ] && source ./lib/function.sh
APP=zigbee2mqtt
VERSION=1.24.0
GIT_VERSION=$VERSION
DEB_VERSION=$VERSION-3
DEBIAN_VERSION_CODENAME=bullseye
IMAGE_SIZE=
STEP="envinit prebuild build makedeb"
envinit() {
apt install -y --no-install-recommends wget ca-certificates nodejs npm git make g++ gcc fakeroot dpkg
}
prebuild(){
GIT_VERSION=$1
git clone --depth 1 -b ${GIT_VERSION} https://github.com/Koenkk/zigbee2mqtt.git /tmp/zigbee2mqtt
}
build() {
cd /tmp/zigbee2mqtt/
npm ci
npm run build
}
makedeb(){
GIT_VERSION=$1
DEB_VERSION=$2
PATH_DEB=/tmp/src/rootfs
cp -fr /tmp/zigbee2mqtt/data/configuration.yaml ${PATH_DEB}/etc/zigbee2mqtt/configuration.yaml
cp -fr /tmp/zigbee2mqtt/* ${PATH_DEB}/usr/lib/zigbee2mqtt/
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
}