nixpkgs/pkgs/servers/home-assistant/update.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.4 KiB
Bash
Raw Normal View History

2020-06-20 13:17:07 +02:00
#!/usr/bin/env nix-shell
#!nix-shell -p nix -p jq -p curl -p bash -p git -p nix-update -i bash
set -eux
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$DIR"
2021-12-11 20:59:08 +01:00
CURRENT_VERSION=$(nix-instantiate ../../.. --eval --strict -A home-assistant.version | tr -d '"')
2020-06-20 13:17:07 +02:00
TARGET_VERSION=$(curl https://api.github.com/repos/home-assistant/core/releases/latest | jq -r '.name')
MANIFEST=$(curl https://raw.githubusercontent.com/home-assistant/core/${TARGET_VERSION}/homeassistant/components/frontend/manifest.json)
FRONTEND_VERSION=$(echo $MANIFEST | jq -r '.requirements[] | select(startswith("home-assistant-frontend")) | sub(".*==(?<vers>.*)"; .vers)')
if [[ "$CURRENT_VERSION" == "$TARGET_VERSION" ]]; then
echo "home-assistant is up-to-date: ${CURRENT_VERSION}"
exit 0
fi
sed -i -e "s/version =.*/version = \"${TARGET_VERSION}\";/" \
component-packages.nix
sed -i -e "s/hassVersion =.*/hassVersion = \"${TARGET_VERSION}\";/" \
default.nix
(
2021-07-08 02:38:18 +02:00
# update the frontend before running parse-requirements, so it doesn't get shown as outdated
2020-06-20 13:17:07 +02:00
cd ../../..
nix-update --version "$FRONTEND_VERSION" home-assistant.python.pkgs.home-assistant-frontend
2021-07-08 02:38:18 +02:00
)
./parse-requirements.py
2021-09-10 03:59:36 +02:00
read
2021-07-08 02:38:18 +02:00
(
cd ../../..
2020-06-20 13:17:07 +02:00
nix-update --version "$TARGET_VERSION" --build home-assistant
)
2021-08-06 22:53:16 +02:00
#git add ./component-packages.nix ./default.nix ./frontend.nix
#git commit -m "home-assistant: ${CURRENT_VERSION} -> ${TARGET_VERSION}"