From 36520cecb5d606ec9aea5dbcf85ed82759fb3bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Wed, 26 Aug 2020 15:52:41 +0200 Subject: [PATCH] canary file location and content; exit after self-update --- example/kiwi.yml | 2 +- kiwi | 14 +++++++++++--- src/etc/version_tag | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/example/kiwi.yml b/example/kiwi.yml index 5cc7c76..f89e075 100644 --- a/example/kiwi.yml +++ b/example/kiwi.yml @@ -2,7 +2,7 @@ # kiwi-scp instance configuration # ################################### -version: '0.1.4' +version: '0.1.5' runtime: storage: /tmp/kiwi diff --git a/kiwi b/kiwi index c122c95..f03783d 100755 --- a/kiwi +++ b/kiwi @@ -25,7 +25,7 @@ KIWI_VERSION="master" KIWI_URI="https://raw.githubusercontent.com/ldericher/kiwi-scp/master/kiwi" INSTALLER_URI="https://raw.githubusercontent.com/ldericher/kiwi-scp/master/install.sh" # canary file: limit curl requests -CANARY_FILENAME="/var/lock/kiwi-scp.canary" +CANARY_FILENAME="/tmp/kiwi-scp.canary" CANARY_MAX_AGE=600 ################### @@ -141,6 +141,11 @@ if [ "${run_kiwi_check}" = "yes" ]; then echo "${installer}" | sh fi + echo "" + echo "####################" + echo "kiwi self-update finished, please re-run your last command." + exit 0 + else echo "" >/dev/stderr echo "####################" >/dev/stderr @@ -152,8 +157,11 @@ if [ "${run_kiwi_check}" = "yes" ]; then fi fi - # refresh canary - touch "${CANARY_FILENAME}" + # refresh canary file + printf '' > "${CANARY_FILENAME}" + echo "Installed: '${hash_local}'" >> "${CANARY_FILENAME}" + echo "Available: '${hash_remote}'" >> "${CANARY_FILENAME}" + chmod 0777 "${CANARY_FILENAME}" fi # check if pwd is a kiwi folder diff --git a/src/etc/version_tag b/src/etc/version_tag index 845639e..9faa1b7 100644 --- a/src/etc/version_tag +++ b/src/etc/version_tag @@ -1 +1 @@ -0.1.4 +0.1.5