summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2020-11-17 13:02:28 +0000
committermidipix <writeonce@midipix.org>2020-11-17 13:02:28 +0000
commit493d9514c0f93056a3acbd8e8a16d421e6a0ebf7 (patch)
tree0a223ba03da8836d89740ff9e350216483824ad4
parent6b9f4ecdfd83b99112c4fca9674dbc5761650989 (diff)
downloadmpackage-493d9514c0f93056a3acbd8e8a16d421e6a0ebf7.tar.bz2
mpackage-493d9514c0f93056a3acbd8e8a16d421e6a0ebf7.tar.xz
once/get_updates.sh: added --check-state support.
-rwxr-xr-xonce/get_updates.sh14
1 files changed, 14 insertions, 0 deletions
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