Skip to content

Commit

Permalink
strap.sh: handle rerunning Strap.
Browse files Browse the repository at this point in the history
When rerunning Strap and Homebrew was already installed the
`HOMEBREW_REPOSITORY` could be unset causing failures.

Also, add a CI test to verify this case.
  • Loading branch information
MikeMcQuaid committed Mar 6, 2021
1 parent eb60444 commit 95fc62b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/tests.yml
Expand Up @@ -27,6 +27,12 @@ jobs:
STRAP_CI: 1
STRAP_DEBUG: 1

- name: Rerun bin/strap.sh
run: bin/strap.sh
env:
STRAP_CI: 1
STRAP_DEBUG: 1

- run: brew config

- run: brew doctor
Expand Down
3 changes: 2 additions & 1 deletion bin/strap.sh
Expand Up @@ -273,7 +273,8 @@ logk
# Setup Homebrew directory and permissions.
logn "Installing Homebrew:"
HOMEBREW_PREFIX="$(brew --prefix 2>/dev/null || true)"
if [ -z "$HOMEBREW_PREFIX" ]; then
HOMEBREW_REPOSITORY="$(brew --repository 2>/dev/null || true)"
if [ -z "$HOMEBREW_PREFIX" ] || [ -z "$HOMEBREW_REPOSITORY" ]; then
UNAME_MACHINE="$(/usr/bin/uname -m)"
if [[ "$UNAME_MACHINE" == "arm64" ]]; then
HOMEBREW_PREFIX="/opt/homebrew"
Expand Down

0 comments on commit 95fc62b

Please sign in to comment.