debmaker/ressources/zigbee2mqtt/zigbee2mqtt

31 lines
707 B
Bash
Executable File

#!/bin/bash
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
}