Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

homeassistant: Added the option to upgrade to a specific version. #150

Merged
merged 7 commits into from
Mar 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/homeassistant.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ $ sudo hassbian-config upgrade homeassistant --beta
$ sudo hassbian-config upgrade homeassistant --dev
```

## Upgrade to to a spesific version
```
$ sudo hassbian-config upgrade homeassistant=0.65.6
```

## Additional info
Running as: `homeassistant`
Configuration dir: `/home/homeassistant/.homeassistant/`
Expand Down
13 changes: 11 additions & 2 deletions package/opt/hassbian/suites/homeassistant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,19 @@ else
echo "Checking current version"
if [ "$BETA" == "true" ]; then
newversion=$(curl -s https://pypi.python.org/pypi/homeassistant/json | grep '"version":' | awk -F'"' '{print $4}')
elif [ ! -z "${VERSIONNUMBER}" ]; then
verify=$(curl -s https://pypi.python.org/pypi/homeassistant/"$VERSIONNUMBER"/json)
if [[ "$verify" = *"Not Found"* ]]; then
echo "Version $VERSIONNUMBER not found..."
echo "Exiting..."
return 0
else
newversion="$VERSIONNUMBER"
fi
else
newversion=$(curl -s https://api.github.com/repos/home-assistant/home-assistant/releases/latest | grep tag_name | awk -F'"' '{print $4}')
fi
sudo -u homeassistant -H /bin/bash << EOF | grep Version | awk '{print $2}'|while read -r version; do if [[ "${newversion}" == "${version}" ]]; then echo "You already have the latest version: $version";exit 1;fi;done
sudo -u homeassistant -H /bin/bash << EOF | grep Version | awk '{print $2}'|while read -r version; do if [[ "${newversion}" == "${version}" ]]; then echo "You already have version: $version";exit 1;fi;done
source /srv/homeassistant/bin/activate
pip3 show homeassistant
EOF
Expand All @@ -99,7 +108,7 @@ sudo -u homeassistant -H /bin/bash << EOF
echo "Changing to Home Assistant venv"
source /srv/homeassistant/bin/activate

echo "Installing latest version of Home Assistant"
echo "Upgrading Home Assistant"
pip3 install --upgrade setuptools wheel
if [ "$DEV" == "true" ]; then
pip3 install git+https://github.com/home-assistant/home-assistant@dev
Expand Down
6 changes: 6 additions & 0 deletions package/usr/local/bin/hassbian-config
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ case $COMMAND in
shift # past value
;;
"upgrade")
if [[ "$SUITE" = *"="* ]]; then
VERSIONNUMBER=$(echo "$SUITE" | awk -F'=' '{print $2}')
SUITE=$(echo "$SUITE" | awk -F'=' '{print $1}')
else
VERSIONNUMBER=""
fi
if verify-suite "$SUITE"; then
RUN="upgrade-suite $SUITE"
else
Expand Down