add simple auto-update mechanism

This commit is contained in:
Florian Schlegel 2020-08-29 21:47:12 +02:00
parent e714a06e04
commit d2273603fe
1 changed files with 15 additions and 1 deletions

View File

@ -258,10 +258,24 @@ print_cvag_schedule()
fi
}
update_script()
{
cd "$(dirname "$0")"
if [ -d ".git" ]; then
git pull >/dev/null || sleep 10
exec ./$(basename -- "$0") "skip_first_update"
fi
}
draw_large_logo
sleep 5
SKIP_UPDATE="$1"
[ "$SKIP_UPDATE" = "skip_first_update" ] && sleep 10
ROUND_COUNT=0
while true; do
[ $ROUND_COUNT -eq 0 -a ! "$SKIP_UPDATE" = "skip_first_update" ] && update_script
SKIP_UPDATE=""
print_cvag_schedule
ROUND_COUNT=$((($ROUND_COUNT + 1) % 60))
sleep 10
done