rc should return
This commit is contained in:
19
rc
19
rc
@@ -69,20 +69,23 @@ unset -f _check_ncsv
|
|||||||
}
|
}
|
||||||
# Update self weekly,
|
# Update self weekly,
|
||||||
# if folder writable, if repository, if an interactive terminal, if not updated the last week
|
# if folder writable, if repository, if an interactive terminal, if not updated the last week
|
||||||
[[ -w "$TOOLSPATH" ]] || return
|
TOOLS_TO_UPDATE=1
|
||||||
[[ -w "$TOOLSPATH"/.hg ]] || return
|
[[ -w "$TOOLSPATH" ]] || TOOLS_TO_UPDATE=0
|
||||||
[[ -t 0 ]] || return
|
[[ -w "$TOOLSPATH"/.hg ]] || TOOLS_TO_UPDATE=0
|
||||||
[[ -t 1 ]] || return
|
[[ -t 0 ]] || TOOLS_TO_UPDATE=0
|
||||||
[[ -t 2 ]] || return
|
[[ -t 1 ]] || TOOLS_TO_UPDATE=0
|
||||||
|
[[ -t 2 ]] || TOOLS_TO_UPDATE=0
|
||||||
[[ -f "$TOOLSPATH"/.lastupdate ]] || touch -t 0101010101 "$TOOLSPATH"/.lastupdate 2> /dev/null
|
[[ -f "$TOOLSPATH"/.lastupdate ]] || touch -t 0101010101 "$TOOLSPATH"/.lastupdate 2> /dev/null
|
||||||
[[ -w "$TOOLSPATH"/.lastupdate ]] || return
|
[[ -w "$TOOLSPATH"/.lastupdate ]] || TOOLS_TO_UPDATE=0
|
||||||
|
|
||||||
|
if [ $TOOLS_TO_UPDATE -eq 1 ]; then
|
||||||
_change_hg_repo
|
_change_hg_repo
|
||||||
unset -f _change_hg_repo
|
|
||||||
|
|
||||||
TOOLS_LASTUPDATE=$(( $( date +%s ) - $( stat -c %Y "$TOOLSPATH"/.lastupdate ) ))
|
TOOLS_LASTUPDATE=$(( $( date +%s ) - $( stat -c %Y "$TOOLSPATH"/.lastupdate ) ))
|
||||||
[[ "$TOOLS_LASTUPDATE" -gt 604800 ]] && _self_update
|
[[ "$TOOLS_LASTUPDATE" -gt 604800 ]] && _self_update
|
||||||
unset TOOLS_LASTUPDATE
|
unset TOOLS_LASTUPDATE
|
||||||
|
fi
|
||||||
|
unset TOOLS_TO_UPDATE
|
||||||
unset -f _self_update
|
unset -f _self_update
|
||||||
|
unset -f _change_hg_repo
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user