force update

This commit is contained in:
q
2015-07-26 21:41:46 +03:00
parent 84b2013511
commit 0ca341e837

18
rc
View File

@@ -10,6 +10,15 @@ export PATH
. "$TOOLSPATH"/qcd_function . "$TOOLSPATH"/qcd_function
function _self_update() {
touch "$TOOLSPATH"/.lastupdate
pushd "$TOOLSPATH" > /dev/null
hg pull -u 2>&1 > /dev/null
popd > /dev/null
}
[[ "$1" = "-u" ]] && _self_update
# Update self weekly # Update self weekly
[[ -t 0 ]] || return [[ -t 0 ]] || return
[[ -t 1 ]] || return [[ -t 1 ]] || return
@@ -18,11 +27,6 @@ export PATH
[[ -f "$TOOLSPATH"/.lastupdate ]] || return [[ -f "$TOOLSPATH"/.lastupdate ]] || return
TOOLS_LASTUPDATE=$(( $( date +%s ) - $( stat -c %Y "$TOOLSPATH"/.lastupdate ) )) TOOLS_LASTUPDATE=$(( $( date +%s ) - $( stat -c %Y "$TOOLSPATH"/.lastupdate ) ))
[[ "$TOOLS_LASTUPDATE" -gt 604800 ]] && { [[ "$TOOLS_LASTUPDATE" -gt 604800 ]] && _self_update
touch "$TOOLSPATH"/.lastupdate
pushd "$TOOLSPATH" > /dev/null
hg pull -u 2>&1 > /dev/null
popd > /dev/null
}
unset TOOLS_LASTUPDATE unset TOOLS_LASTUPDATE
unset -f _self_update