force update
This commit is contained in:
18
rc
18
rc
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user