Fix esphome_fork not installing correctly (#49)

This commit is contained in:
Jesse Hills 2021-11-09 15:42:01 +13:00 committed by GitHub
parent 58fddea6ee
commit a09e06aa8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,12 +18,18 @@ if bashio::config.has_value 'esphome_fork'; then
username="esphome"
ref=$esphome_fork
fi
full_url="https://github.com/${username}/esphome/archive/${ref}.zip"
full_url="https://github.com/${username}/esphome/archive/${ref}.tar.gz"
bashio::log.info "Checking forked ESPHome"
dev_version=$(python3 -c "from esphome.const import __version__; print(__version__)")
bashio::log.info "Installing esphome from fork '${esphome_fork}' (${full_url})..."
pip3 install -U --no-cache-dir "${full_url}" -qq \
|| bashio::exit.nok "Failed installing esphome pinned version."
bashio::log.info "Downloading ESPHome from fork '${esphome_fork}' (${full_url})..."
curl -L -o /tmp/esphome.tar.gz "${full_url}" -qq \
|| bashio::exit.nok "Failed downloading ESPHome fork."
bashio::log.info "Installing ESPHome from fork '${esphome_fork}' (${full_url})..."
mkdir /esphome-fork
tar -zxvf /tmp/esphome.tar.gz -C /esphome-fork --strip-components=1 \
|| bashio::exit.nok "Failed installing ESPHome from fork."
pip install -U -e /esphome-fork || bashio::exit.nok "Failed installing ESPHome from fork."
rm -f /tmp/esphome.tar.gz
fork_version=$(python3 -c "from esphome.const import __version__; print(__version__)")
if [[ "$fork_version" != "$dev_version" ]]; then
@ -36,4 +42,5 @@ if bashio::config.has_value 'esphome_fork'; then
bashio::log.error "############################"
bashio::exit.nok
fi
bashio::log.info "Installed ESPHome from fork '${esphome_fork}' (${full_url})..."
fi