stop if not writable

This commit is contained in:
Ville Rantanen
2015-08-20 14:10:16 +03:00
parent 1f8654a0ca
commit 658e1d206a

2
rc
View File

@@ -24,7 +24,7 @@ function _self_update() {
[[ -t 1 ]] || return [[ -t 1 ]] || return
[[ -t 2 ]] || return [[ -t 2 ]] || return
[[ -f "$TOOLSPATH"/.lastupdate ]] || touch -t 0101010101 "$TOOLSPATH"/.lastupdate 2> /dev/null [[ -f "$TOOLSPATH"/.lastupdate ]] || touch -t 0101010101 "$TOOLSPATH"/.lastupdate 2> /dev/null
[[ -f "$TOOLSPATH"/.lastupdate ]] || return [[ -w "$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 ]] && _self_update [[ "$TOOLS_LASTUPDATE" -gt 604800 ]] && _self_update