Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

improve detection if brew needs sudo

  • Loading branch information...
commit f6e469f3f6f853603973a929ee21bed758c59056 1 parent 26aed1f
@mpapis mpapis authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 scripts/functions/requirements/osx
View
12 scripts/functions/requirements/osx
@@ -25,7 +25,17 @@ function requirements_brew()
esac
done
- (( UID == 0 )) || command_to_run+=( sudo )
+ (( UID == 0 )) || {
+ typeset brew_path
+ brew_path="$( \which brew 2>/dev/null )"
+ {
+ # has to be executable for the running user
+ [[ -x "${brew_path}" ]] &&
+ # must be owned by user or sticky bit set -- #TODO: might need improvement
+ [[ -O "${brew_path}" || -G "${brew_path}" || -u "${brew_path}" || -g "${brew_path}" ]]
+ } ||
+ command_to_run+=( sudo )
+ }
while
(( $# ))
Please sign in to comment.
Something went wrong with that request. Please try again.