Last active
January 16, 2020 00:33
-
-
Save gizmoguy/4932421d41d3d5383907ab3029863d9d to your computer and use it in GitHub Desktop.
Galmon auto-update in docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git_tmp_dir=$(mktemp -d /tmp/galmon-XXXXX) | |
git clone --recursive https://github.com/ahupowerdns/galmon.git "${git_tmp_dir}" | |
cd "${git_tmp_dir}" | |
running_ver=$(sudo docker exec -it galmon cat githash.h | grep -Eo 'GIT_HASH "[a-z0-9]+"' | cut -d ' ' -f 2 | tr -d '"') | |
upstream_ver=$(git describe --always --dirty=+ | tr -d '\n') | |
if [ ! -z "${upstream_ver}" ]; then | |
if [ "${running_ver}" == "${upstream_ver}" ]; then | |
echo "No newer version available, not updating" | |
else | |
sudo docker build --pull --no-cache -t galmon --build-arg MAKE_FLAGS=-j1 . | |
sudo docker stop galmon && sudo docker rm galmon | |
sudo docker run -d --restart=always --device=/dev/ttyACM0 --name=galmon galmon /galmon/ubxtool --wait --port /dev/ttyACM0 --gps --galileo --glonass | |
sudo docker system prune --force | |
fi | |
fi | |
rm -rf "${git_tmp_dir}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment