#!/bin/ash delay=900 version_file=/etc/lixonet/version while true do ( set -e current_version=`cat $version_file || echo 0` gpg --import /dev/null (echo 5; echo y; echo save) | gpg --command-fd 0 --no-tty --no-greeting -q --edit-key "$(gpg --list-packets /dev/null git fetch $GIT_URL latest_commit=`git log "--format=%G? %H" | grep ^G | head -n 1 | cut -d' ' -f2` if test -z $latest_commit; then echo "No trusted commits found! Re-checking in 60 seconds..." sleep 60 continue fi git checkout $latest_commit checkout_version=`cat version` if [ "$checkout_version" -gt "$current_version" ]; then echo "Updating to version $checkout_version..." chmod +x build.sh && ./build.sh echo "Updated to version $checkout_version." echo $checkout_version > $version_file fi ) sleep $delay done