From 535f7165c57b27ddd75ea719588b389052364d92 Mon Sep 17 00:00:00 2001 From: mib1185 Date: Fri, 28 Jan 2022 18:20:02 +0000 Subject: [PATCH 1/3] user PWD env variable in script.core --- script/core | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/script/core b/script/core index 00d663cab25e..81485974f1e9 100755 --- a/script/core +++ b/script/core @@ -16,9 +16,9 @@ if [ -z $(which hass) ]; then git+git://github.com/home-assistant/home-assistant.git@dev fi -if [ ! -d "/workspaces/frontend/config" ]; then +if [ ! -d "${PWD}/config" ]; then echo "Creating default configuration." - mkdir -p "/workspaces/frontend/config"; + mkdir -p "${PWD}/config"; hass --script ensure_config -c config echo "demo: @@ -26,24 +26,24 @@ logger: default: info logs: homeassistant.components.frontend: debug -" >> /workspaces/frontend/config/configuration.yaml +" >> "${PWD}/config/configuration.yaml" if [ ! -z "${HASSIO}" ]; then echo " # frontend: -# development_repo: /workspaces/frontend +# development_repo: ${PWD} hassio: - development_repo: /workspaces/frontend" >> /workspaces/frontend/config/configuration.yaml + development_repo: ${PWD}" >> "${PWD}/config/configuration.yaml" else echo " frontend: - development_repo: /workspaces/frontend + development_repo: ${PWD} # hassio: -# development_repo: /workspaces/frontend" >> /workspaces/frontend/config/configuration.yaml +# development_repo: ${PWD}" >> "${PWD}/config/configuration.yaml" fi fi -hass -c /workspaces/frontend/config +hass -c "${PWD}/config" From a45513d2f3232245392b4bc63d8d0ee3f3b951ae Mon Sep 17 00:00:00 2001 From: mib1185 Date: Sat, 12 Feb 2022 00:19:03 +0000 Subject: [PATCH 2/3] use containerWorkspaceFolder --- .devcontainer/devcontainer.json | 3 +++ script/core | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 977620c9ddf5..746fa306975c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -16,6 +16,9 @@ "runem.lit-plugin", "ms-python.vscode-pylance" ], + "containerEnv": { + "WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}" + }, "settings": { "terminal.integrated.shell.linux": "/bin/bash", "files.eol": "\n", diff --git a/script/core b/script/core index 81485974f1e9..83e2f772df19 100755 --- a/script/core +++ b/script/core @@ -4,6 +4,8 @@ # Stop on errors set -e +WD="${WORKSPACE_DIRECTORY:=/workspaces/frontend/}" + if [ -z "${DEVCONTAINER}" ]; then echo "This task should only run inside a devcontainer, for local install HA Core in a venv." exit 1 @@ -16,9 +18,9 @@ if [ -z $(which hass) ]; then git+git://github.com/home-assistant/home-assistant.git@dev fi -if [ ! -d "${PWD}/config" ]; then +if [ ! -d "${WD}/config" ]; then echo "Creating default configuration." - mkdir -p "${PWD}/config"; + mkdir -p "${WD}/config"; hass --script ensure_config -c config echo "demo: @@ -26,24 +28,24 @@ logger: default: info logs: homeassistant.components.frontend: debug -" >> "${PWD}/config/configuration.yaml" +" >> "${WD}/config/configuration.yaml" if [ ! -z "${HASSIO}" ]; then echo " # frontend: -# development_repo: ${PWD} +# development_repo: ${WD} hassio: - development_repo: ${PWD}" >> "${PWD}/config/configuration.yaml" + development_repo: ${WD}" >> "${WD}/config/configuration.yaml" else echo " frontend: - development_repo: ${PWD} + development_repo: ${WD} # hassio: -# development_repo: ${PWD}" >> "${PWD}/config/configuration.yaml" +# development_repo: ${WD}" >> "${WD}/config/configuration.yaml" fi fi -hass -c "${PWD}/config" +hass -c "${WD}/config" From 99e6a636d44b063a06dfbc23f64edf476c00b083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Sat, 12 Feb 2022 07:19:11 +0100 Subject: [PATCH 3/3] Update script/core --- script/core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/core b/script/core index 83e2f772df19..79ba38a34839 100755 --- a/script/core +++ b/script/core @@ -4,7 +4,7 @@ # Stop on errors set -e -WD="${WORKSPACE_DIRECTORY:=/workspaces/frontend/}" +WD="${WORKSPACE_DIRECTORY:=/workspaces/frontend}" if [ -z "${DEVCONTAINER}" ]; then echo "This task should only run inside a devcontainer, for local install HA Core in a venv."