From c7ac17f0a9944a5aa37dd89962501f1d1dfa07a7 Mon Sep 17 00:00:00 2001 From: Q Date: Tue, 4 Nov 2025 12:46:01 +0200 Subject: [PATCH] check for version --- rc | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/rc b/rc index 2018352..6fd2ff4 100755 --- a/rc +++ b/rc @@ -30,17 +30,23 @@ function _q-tools-update-binary { # update self [[ -z "$QTOOLSPATH" ]] && return [[ -w "$QTOOLSPATH" ]] || return - #local foo - #echo "Updating with binary deletes the existing folder! sure? y/N" - #read foo - #[[ "$foo" = y ]] || return pushd ~ >/dev/null - set -u - rm -rf "$QTOOLSPATH" - mkdir -p "$QTOOLSPATH" - curl -L https://six9.net/software/q-tools/current.tar.gz | \ - tar xz -C "$QTOOLSPATH" - set +u + if [[ ! -e .version ]]; then + touch .version + fi + local current_version + local remote_version + current_version=$( cat .version ) + remote_version=$( curl -f -s -L https://six9.net/software/q-tools/current.txt ) + if [[ "$remote_version" != "$current_version" ]]; then + set -u + echo "Update $current_version => $remote_version" + #rm -rf "$QTOOLSPATH" + mkdir -p "$QTOOLSPATH" + curl -L -f -s https://six9.net/software/q-tools/current.tar.gz | \ + tar xz -C "$QTOOLSPATH" + set +u + fi popd > /dev/null _q-tools-reload @@ -52,8 +58,6 @@ function _self_update() { if [[ -d .git ]]; then git remote get-url origin 2>&1 | grep -q https.*git.six9.net && { _q-tools-update-binary - popd > /dev/null - } if [[ "$1" = "-u" ]]; then git pull