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

Update upgrade_home-assistant.sh #71

Merged
merged 1 commit into from
Jan 27, 2018
Merged

Conversation

riemers
Copy link
Contributor

@riemers riemers commented Nov 4, 2017

Added a so that it skips upgrading if the version is already installed. If you want to be on the edge you can now crontab the upgrade or similar. Perhaps there is a better way, but this one seemed ok. Don't really need that json function but it might be handy for other stuff too.

@homeassistant
Copy link

Hi @riemers,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

Copy link
Collaborator

@Landrash Landrash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great with a minor adjustment requested for usability.

EOF

if [[ $? == 1 ]]; then
echo "Stopping upgrade"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit more descriptive error message and this is good to merge


versiongit=$(curl -s -X GET https://api.github.com/repos/home-assistant/home-assistant/releases/latest | jsonValue tag_name 1|sed -e 's/^[[:space:]]*//')

sudo -u homeassistant -H /bin/bash << EOF | grep Version|awk '{print $2'}|while read version; do if [[ ${versiongit} == ${version} ]]; then echo "You already have the latest version: $version";exit 1;fi;done
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line has the more descriptive error message, but since its in the pipe of the EOF i did it here otherwise you loose the string value.

@Landrash Landrash added this to the v0.7 milestone Jan 27, 2018
Copy link
Collaborator

@Landrash Landrash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and tagged for 0.7.

@Landrash Landrash merged commit 36cf324 into home-assistant:dev Jan 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants