diff options
author | Martin Weinelt <hexa@darmstadt.ccc.de> | 2020-08-03 03:52:06 +0200 |
---|---|---|
committer | Martin Weinelt <hexa@darmstadt.ccc.de> | 2020-08-03 16:17:48 +0200 |
commit | 9d284f35488c5744e2c7f2ccb1fefd12eecfd7ed (patch) | |
tree | 733e890d44d1ae86274ef1344fd10fb8bed473a8 /pkgs/servers/zigbee2mqtt | |
parent | 4181ae25bffd50169b3c2ff951db3b7f84afa8c0 (diff) |
zigbee2mqtt: upgrade deps.sh to update.sh
Diffstat (limited to 'pkgs/servers/zigbee2mqtt')
-rwxr-xr-x | pkgs/servers/zigbee2mqtt/deps.sh | 15 | ||||
-rwxr-xr-x | pkgs/servers/zigbee2mqtt/update.sh | 30 |
2 files changed, 30 insertions, 15 deletions
diff --git a/pkgs/servers/zigbee2mqtt/deps.sh b/pkgs/servers/zigbee2mqtt/deps.sh deleted file mode 100755 index c5c66a6a7a835..0000000000000 --- a/pkgs/servers/zigbee2mqtt/deps.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env nix-shell -#! nix-shell -i bash -p nodePackages.node2nix nodejs-12_x -VERSION=1.14.1 -ZIGBEE2MQTT=https://raw.githubusercontent.com/Koenkk/zigbee2mqtt/$VERSION - -wget $ZIGBEE2MQTT/package.json -wget $ZIGBEE2MQTT/npm-shrinkwrap.json - -node2nix --nodejs-12 \ - -l npm-shrinkwrap.json \ - -c node.nix \ - --bypass-cache \ - --no-copy-node-env \ - --node-env ../../development/node-packages/node-env.nix -rm package.json npm-shrinkwrap.json diff --git a/pkgs/servers/zigbee2mqtt/update.sh b/pkgs/servers/zigbee2mqtt/update.sh new file mode 100755 index 0000000000000..7fd32dff4634b --- /dev/null +++ b/pkgs/servers/zigbee2mqtt/update.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env nix-shell +#! nix-shell -i bash -p nodePackages.node2nix nodejs-12_x curl jq nix-update + +CURRENT_VERSION=$(nix eval --raw '(with import ../../.. {}; zigbee2mqtt.version)') +TARGET_VERSION=$(curl https://api.github.com/repos/Koenkk/zigbee2mqtt/releases/latest | jq -r ".tag_name") +ZIGBEE2MQTT=https://github.com/Koenkk/zigbee2mqtt/raw/$TARGET_VERSION + +if [[ "$CURRENT_VERSION" == "$TARGET_VERSION" ]]; then + echo "zigbee2mqtt is up-to-date: ${CURRENT_VERSION}" + exit 0 +fi + +wget $ZIGBEE2MQTT/package.json +wget $ZIGBEE2MQTT/npm-shrinkwrap.json + +node2nix --nodejs-12 \ + -l npm-shrinkwrap.json \ + -c node.nix \ + --bypass-cache \ + --no-copy-node-env \ + --node-env ../../development/node-packages/node-env.nix +rm package.json npm-shrinkwrap.json + +{ + cd ../../.. + nix-update --version "$TARGET_VERSION" --build zigbee2mqtt +} + +git add ./default.nix ./node-packages.nix ./node.nix +git commit -m "zigbee2mqtt: ${CURRENT_VERSION} -> ${TARGET_VERSION}" |