rc should return

This commit is contained in:
Ville Rantanen
2017-02-10 10:56:54 +02:00
parent a9c0709055
commit 47b1d21ccb

27
rc
View File

@@ -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
_change_hg_repo if [ $TOOLS_TO_UPDATE -eq 1 ]; then
_change_hg_repo
TOOLS_LASTUPDATE=$(( $( date +%s ) - $( stat -c %Y "$TOOLSPATH"/.lastupdate ) ))
[[ "$TOOLS_LASTUPDATE" -gt 604800 ]] && _self_update
unset TOOLS_LASTUPDATE
fi
unset TOOLS_TO_UPDATE
unset -f _self_update
unset -f _change_hg_repo unset -f _change_hg_repo
TOOLS_LASTUPDATE=$(( $( date +%s ) - $( stat -c %Y "$TOOLSPATH"/.lastupdate ) ))
[[ "$TOOLS_LASTUPDATE" -gt 604800 ]] && _self_update
unset TOOLS_LASTUPDATE
unset -f _self_update