Fix docker pio settings not applied (#2370)

This commit is contained in:
Otto Winter 2021-09-22 10:32:39 +02:00 committed by GitHub
parent 40e0100c1e
commit 11daabc9c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 8 deletions

View file

@ -4,15 +4,21 @@
# otherwise use path in /config (so that PIO packages aren't downloaded on each compile)
if [[ -d /cache ]]; then
export PLATFORMIO_CORE_DIR=/cache/platformio
pio_cache_base=/cache/platformio
else
export PLATFORMIO_CORE_DIR=/config/.esphome/platformio
pio_cache_base=/config/.esphome/platformio
fi
if [[ ! -d "${PLATFORMIO_CORE_DIR}" ]]; then
echo "Creating cache directory ${PLATFORMIO_CORE_DIR}"
if [[ ! -d "${pio_cache_base}" ]]; then
echo "Creating cache directory ${pio_cache_base}"
echo "You can change this behavior by mounting a directory to the container's /cache directory."
mkdir -p "${PLATFORMIO_CORE_DIR}"
mkdir -p "${pio_cache_base}"
fi
# we can't set core_dir, because the settings file is stored in `core_dir/appstate.json`
# setting `core_dir` would therefore prevent pio from accessing
export PLATFORMIO_PLATFORMS_DIR="${pio_cache_base}/platforms"
export PLATFORMIO_PACKAGES_DIR="${pio_cache_base}/packages"
export PLATFORMIO_CACHE_DIR="${pio_cache_base}/cache"
exec esphome "$@"

View file

@ -4,6 +4,6 @@
# This files creates all directories used by esphome
# ==============================================================================
PLATFORMIO_CORE_DIR=/data/cache/platformio
pio_cache_base=/data/cache/platformio
mkdir -p "${PLATFORMIO_CORE_DIR}"
mkdir -p "${pio_cache_base}"

View file

@ -22,7 +22,13 @@ if bashio::config.has_value 'relative_url'; then
export ESPHOME_DASHBOARD_RELATIVE_URL=$(bashio::config 'relative_url')
fi
export PLATFORMIO_CORE_DIR=/data/cache/platformio
pio_cache_base=/data/cache/platformio
# we can't set core_dir, because the settings file is stored in `core_dir/appstate.json`
# setting `core_dir` would therefore prevent pio from accessing
export PLATFORMIO_PLATFORMS_DIR="${pio_cache_base}/platforms"
export PLATFORMIO_PACKAGES_DIR="${pio_cache_base}/packages"
export PLATFORMIO_CACHE_DIR="${pio_cache_base}/cache"
export PLATFORMIO_GLOBALLIB_DIR=/piolibs
bashio::log.info "Starting ESPHome dashboard..."