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