Skip to content

Instantly share code, notes, and snippets.

@koter84
Last active January 27, 2023 14:38
Show Gist options
  • Save koter84/86790850aa63354bda56d041de31dc70 to your computer and use it in GitHub Desktop.
Save koter84/86790850aa63354bda56d041de31dc70 to your computer and use it in GitHub Desktop.
#!/bin/bash
self_file="$0"
self_source_url="https://raw.githubusercontent.com/koter84/HomeAssistant_Blueprints_Update/main/blueprints_update.sh"
# print info function
function _blueprint_update_info
{
echo "$@"
}
# create a temp file for downloading
_tempfile=$(mktemp -t blueprints_update.XXXXXX)
# start message
_blueprint_update_info "> ${self_file}"
# update
wget -q -O "${_tempfile}" "${self_source_url}"
wget_result=$?
if [ "${wget_result}" != "0" ]
then
_blueprint_update_info "! something went wrong while downloading, exiting..."
_blueprint_update_info
exit
fi
self_diff=$(diff "${self_file}" "${_tempfile}")
if [ "${self_diff}" == "" ]
then
_blueprint_update_info "-> self up-2-date"
else
cp "${_tempfile}" "${self_file}"
chmod +x "${self_file}"
_blueprint_update_info "-! self updated!"
exit
fi
_blueprint_update_info
@koter84
Copy link
Author

koter84 commented Jan 25, 2023

i have made a full github repository for this script, which you can find on https://github.com/koter84/HomeAssistant_Blueprints_Update/

i'm currently fixing some errors and adding a couple of features, once i commit that to the new repository i'll update this script to auto-update to that repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment