self update mechanism
This commit is contained in:
13
rc
13
rc
@@ -10,3 +10,16 @@ export PATH
|
|||||||
|
|
||||||
. "$TOOLSPATH"/qcd_function
|
. "$TOOLSPATH"/qcd_function
|
||||||
|
|
||||||
|
# Update self weekly
|
||||||
|
[[ -f "$TOOLSPATH"/.lastupdate ]] || touch -t 0101010101 "$TOOLSPATH"/.lastupdate
|
||||||
|
[[ -f "$TOOLSPATH"/.lastupdate ]] || return
|
||||||
|
|
||||||
|
TOOLS_LASTUPDATE=$(( $( date +%s ) - $( stat -c %Y "$TOOLSPATH"/.lastupdate ) ))
|
||||||
|
[[ "$TOOLS_LASTUPDATE" -gt 604800 ]] && {
|
||||||
|
touch "$TOOLSPATH"/.lastupdate
|
||||||
|
pushd "$TOOLSPATH" > /dev/null
|
||||||
|
hg pull -u
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
unset TOOLS_LASTUPDATE
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user