Skip to content

Commit

Permalink
Add & change some logging in startup script.
Browse files Browse the repository at this point in the history
  • Loading branch information
jo12bar authored Aug 4, 2018
1 parent e6d3f3b commit 131b573
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions raspi-scripts/startup
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,29 @@ info 'Waiting for a network connection...'
while true; do
ping -c1 www.example.com &> /dev/null && break
done
success 'Network connected!'

info 'Checking to see if startup script has changed...'
current_git_sha=$(git rev-parse HEAD)
curl_url="https://api.github.com/repos/jo12bar/medimap-viewer/compare/jo12bar:${current_git_sha}...jo12bar:HEAD"
jq_program="if .files[].filename == \"raspi-scripts/startup\" then true else false end"
changed_files_processed=$(curl -H 'Accept: application/vnd.github.v3+json' "${curl_url}" | jq "${jq_program}")
if [[ "${changed_files_processed}" == *"true"* ]]; then
info 'Startup script has been changed!'
success 'Startup script has been changed!'
info 'Going to update code, then restart.'
git pull origin master
reboot
else
info 'Startup file unchanged!'
success 'Startup file unchanged!'
fi

# Check for local excutable startup file in $INSTALL_DIR/local
if [ -x "${INSTALL_DIR}/local/startup.local.bash" ]; then
info "Executing ${INSTALL_DIR}/local/startup.local.bash"
"${INSTALL_DIR}/local/startup.local.bash"
else
fail "No startup file found in ${INSTALL_DIR}/local."
user 'Did you remember to install local config? The server will probably crash as a result.'
fi

# Load up nvm, and use node.js version 10.x
Expand Down

0 comments on commit 131b573

Please sign in to comment.