Add WORKSPACE_DIRECTORY environment variable to devcontainer and script.core (#11477)

Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
pull/11673/head
Michael 2022-02-12 07:30:19 +01:00 committed by GitHub
parent e1c07f109c
commit bef6591548
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

@ -16,6 +16,9 @@
"runem.lit-plugin", "runem.lit-plugin",
"ms-python.vscode-pylance" "ms-python.vscode-pylance"
], ],
"containerEnv": {
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
},
"settings": { "settings": {
"terminal.integrated.shell.linux": "/bin/bash", "terminal.integrated.shell.linux": "/bin/bash",
"files.eol": "\n", "files.eol": "\n",

View File

@ -4,6 +4,8 @@
# Stop on errors # Stop on errors
set -e set -e
WD="${WORKSPACE_DIRECTORY:=/workspaces/frontend}"
if [ -z "${DEVCONTAINER}" ]; then if [ -z "${DEVCONTAINER}" ]; then
echo "This task should only run inside a devcontainer, for local install HA Core in a venv." echo "This task should only run inside a devcontainer, for local install HA Core in a venv."
exit 1 exit 1
@ -16,9 +18,9 @@ if [ -z $(which hass) ]; then
git+git://github.com/home-assistant/home-assistant.git@dev git+git://github.com/home-assistant/home-assistant.git@dev
fi fi
if [ ! -d "/workspaces/frontend/config" ]; then if [ ! -d "${WD}/config" ]; then
echo "Creating default configuration." echo "Creating default configuration."
mkdir -p "/workspaces/frontend/config"; mkdir -p "${WD}/config";
hass --script ensure_config -c config hass --script ensure_config -c config
echo "demo: echo "demo:
@ -26,24 +28,24 @@ logger:
default: info default: info
logs: logs:
homeassistant.components.frontend: debug homeassistant.components.frontend: debug
" >> /workspaces/frontend/config/configuration.yaml " >> "${WD}/config/configuration.yaml"
if [ ! -z "${HASSIO}" ]; then if [ ! -z "${HASSIO}" ]; then
echo " echo "
# frontend: # frontend:
# development_repo: /workspaces/frontend # development_repo: ${WD}
hassio: hassio:
development_repo: /workspaces/frontend" >> /workspaces/frontend/config/configuration.yaml development_repo: ${WD}" >> "${WD}/config/configuration.yaml"
else else
echo " echo "
frontend: frontend:
development_repo: /workspaces/frontend development_repo: ${WD}
# hassio: # hassio:
# development_repo: /workspaces/frontend" >> /workspaces/frontend/config/configuration.yaml # development_repo: ${WD}" >> "${WD}/config/configuration.yaml"
fi fi
fi fi
hass -c /workspaces/frontend/config hass -c "${WD}/config"