From 493d9514c0f93056a3acbd8e8a16d421e6a0ebf7 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 17 Nov 2020 13:02:28 +0000 Subject: once/get_updates.sh: added --check-state support. --- once/get_updates.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'once') diff --git a/once/get_updates.sh b/once/get_updates.sh index 1d3b191..7e779db 100755 --- a/once/get_updates.sh +++ b/once/get_updates.sh @@ -9,6 +9,7 @@ mb_path="$PATH" mb_script="$0" mb_success=no mb_obtain=no +mb_state=true mb_dlopt="${1:-}" error_msg() @@ -112,6 +113,8 @@ for tarball in ${mb_tarballs:-}; do printf '\tcached signature: %s\n' $mb_localsig >&3 if [ $mb_localsig != $mb_remotesig ]; then + mb_state=false + printf '\tsignatures do not match, download needed.\n' >&3 if [ $mb_obtain = no ]; then @@ -133,6 +136,8 @@ for tarball in ${mb_tarballs:-}; do fi fi else + mb_state=false + printf '\t/updates/%s found, checking signatures...\n' $tarball >&3 if ! [ -f /updates/$tarball.sha256 ]; then @@ -182,6 +187,15 @@ for tarball in ${mb_tarballs:-}; do printf '\n' >&3 done +# already up-to-date? +if [ "${mb_dlopt}" = '--check-state' ]; then + if [ $mb_state = true ]; then + update_success + else + update_needed + fi +fi + # status touch /updates/update.pending -- cgit v1.2.3