From 41b065c6ee3c5063202cac1bc65b0f8cf8cd6e64 Mon Sep 17 00:00:00 2001 From: Andrey Khrolenok Date: Wed, 22 Nov 2023 07:30:36 +0300 Subject: [PATCH] Update devcontainer --- .../helpers/common/homeassistant/start.sh | 16 ++++++++-------- .../container/helpers/integration/init.sh | 10 +++++----- .devcontainer/install/init.sh | 1 - .devcontainer/install/integration.sh | 3 --- config/bootstrap.sh | 2 +- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.devcontainer/container/helpers/common/homeassistant/start.sh b/.devcontainer/container/helpers/common/homeassistant/start.sh index 8770e79..080e956 100644 --- a/.devcontainer/container/helpers/common/homeassistant/start.sh +++ b/.devcontainer/container/helpers/common/homeassistant/start.sh @@ -4,25 +4,25 @@ source /opt/container/helpers/common/paths.sh mkdir -p /config -if test -f ".devcontainer/configuration.yaml"; then +if test -f "$(workspacePath)config/configuration.yaml"; then echo "Copy configuration.yaml" - ln -sf "$(workspacePath).devcontainer/configuration.yaml" /config/configuration.yaml || echo ".devcontainer/configuration.yaml are missing" + ln -sf "$(workspacePath)config/configuration.yaml" /config/configuration.yaml || echo "config/configuration.yaml are missing" fi -if test -f ".devcontainer/ui-lovelace.yaml"; then +if test -f "$(workspacePath)config/ui-lovelace.yaml"; then echo "Copy ui-lovelace.yaml" - ln -sf "$(workspacePath).devcontainer/ui-lovelace.yaml" /config/ui-lovelace.yaml || echo "" + ln -sf "$(workspacePath)config/ui-lovelace.yaml" /config/ui-lovelace.yaml || echo "" fi -if test -f ".devcontainer/secrets.yaml"; then +if test -f "$(workspacePath)config/secrets.yaml"; then echo "Copy secrets.yaml" - ln -sf "$(workspacePath).devcontainer/secrets.yaml" /config/secrets.yaml || echo "" + ln -sf "$(workspacePath)config/secrets.yaml" /config/secrets.yaml || echo "" fi -if test -d "custom_components"; then +if test -d "$(workspacePath)custom_components"; then echo "Symlink the custom component directory" - if test -d "custom_components"; then + if test -d "$(workspacePath)custom_components"; then rm -R /config/custom_components fi diff --git a/.devcontainer/container/helpers/integration/init.sh b/.devcontainer/container/helpers/integration/init.sh index 754444e..7118acb 100644 --- a/.devcontainer/container/helpers/integration/init.sh +++ b/.devcontainer/container/helpers/integration/init.sh @@ -4,8 +4,8 @@ source /opt/container/helpers/common/paths.sh -if test -d "$(GetWorkspaceName).git"; then - echo ".git exsist in $(GetWorkspaceName), existing initializing" +if test -d "$(workspacePath).git"; then + echo ".git exsist in $(workspacePath), existing initializing" exit 1 fi @@ -16,6 +16,6 @@ git clone https://github.com/custom-components/integration-blueprint.git /tmp/in rm -R /tmp/init/.git rm -R /tmp/init/.devcontainer -cp -a /tmp/init/. "$(GetWorkspaceName)" -cd "$(GetWorkspaceName)" || exit 1 -git init \ No newline at end of file +cp -a /tmp/init/. "$(workspacePath)" +cd "$(workspacePath)" || exit 1 +git init diff --git a/.devcontainer/install/init.sh b/.devcontainer/install/init.sh index e0c2704..868efb4 100644 --- a/.devcontainer/install/init.sh +++ b/.devcontainer/install/init.sh @@ -2,4 +2,3 @@ uname -m printenv - diff --git a/.devcontainer/install/integration.sh b/.devcontainer/install/integration.sh index d0b86d4..bb3fbb5 100644 --- a/.devcontainer/install/integration.sh +++ b/.devcontainer/install/integration.sh @@ -39,9 +39,6 @@ apt-get install -y --no-install-recommends \ xz-utils \ zlib1g-dev - -mkdir -p /config/custom_components - python3 -m pip --disable-pip-version-check install --upgrade \ git+https://github.com/home-assistant/home-assistant.git@dev python3 -m pip --disable-pip-version-check install --upgrade wheel setuptools diff --git a/config/bootstrap.sh b/config/bootstrap.sh index 1b4c33a..4b68a67 100755 --- a/config/bootstrap.sh +++ b/config/bootstrap.sh @@ -5,4 +5,4 @@ ROOT="$( cd "$( dirname "$(readlink -f "$0")" )/.." >/dev/null 2>&1 && pwd )" GITHUB_TOKEN=$(grep github_token ${ROOT}/secrets.yaml | cut -d' ' -f2) FILES=$(grep "{GITHUB_TOKEN}" ${ROOT}/requirements.txt | sed "s/{GITHUB_TOKEN}/${GITHUB_TOKEN}/g" | tr "\r\n" " ") -python3 -m pip install --upgrade ${FILES} +[ -z "${FILES}" ] || python3 -m pip install --upgrade ${FILES}