check for version
This commit is contained in:
20
rc
20
rc
@@ -30,17 +30,23 @@ function _q-tools-update-binary {
|
|||||||
# update self
|
# update self
|
||||||
[[ -z "$QTOOLSPATH" ]] && return
|
[[ -z "$QTOOLSPATH" ]] && return
|
||||||
[[ -w "$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
|
pushd ~ >/dev/null
|
||||||
|
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
|
set -u
|
||||||
rm -rf "$QTOOLSPATH"
|
echo "Update $current_version => $remote_version"
|
||||||
|
#rm -rf "$QTOOLSPATH"
|
||||||
mkdir -p "$QTOOLSPATH"
|
mkdir -p "$QTOOLSPATH"
|
||||||
curl -L https://six9.net/software/q-tools/current.tar.gz | \
|
curl -L -f -s https://six9.net/software/q-tools/current.tar.gz | \
|
||||||
tar xz -C "$QTOOLSPATH"
|
tar xz -C "$QTOOLSPATH"
|
||||||
set +u
|
set +u
|
||||||
|
fi
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
_q-tools-reload
|
_q-tools-reload
|
||||||
|
|
||||||
@@ -52,8 +58,6 @@ function _self_update() {
|
|||||||
if [[ -d .git ]]; then
|
if [[ -d .git ]]; then
|
||||||
git remote get-url origin 2>&1 | grep -q https.*git.six9.net && {
|
git remote get-url origin 2>&1 | grep -q https.*git.six9.net && {
|
||||||
_q-tools-update-binary
|
_q-tools-update-binary
|
||||||
popd > /dev/null
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if [[ "$1" = "-u" ]]; then
|
if [[ "$1" = "-u" ]]; then
|
||||||
git pull
|
git pull
|
||||||
|
|||||||
Reference in New Issue
Block a user