Skip to content

Commit 73477e3

Browse files
committed
Refactor
1 parent 03933ba commit 73477e3

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

bin/cz

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
# Run chezmoi in a clean environment with Homebrew environment variables set up.
33
set -eu
44

5-
brew="${HOMEBREW_PREFIX:-/opt/homebrew}/bin/brew"
6-
7-
env -i HOME="$HOME" GITHUB_ACTIONS="${GITHUB_ACTIONS:-}" /bin/bash --noprofile --norc << EOF
8-
eval "\$(/usr/libexec/path_helper -s)"
9-
eval "\$("$brew" shellenv)"
10-
chezmoi "$@"
5+
exec env -i \
6+
HOME="$HOME" \
7+
HOMEBREW_PREFIX="${HOMEBREW_PREFIX:-/opt/homebrew}" \
8+
GITHUB_ACTIONS="${GITHUB_ACTIONS:-}" \
9+
/bin/bash --noprofile --norc -s "$@" << 'EOF'
10+
eval "$(/usr/libexec/path_helper -s)"
11+
eval "$("$HOMEBREW_PREFIX/bin/brew" shellenv)"
12+
exec chezmoi "$@"
1113
EOF

install.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@ fi
2626

2727
echo "Installing and initializing chezmoi"
2828

29-
env -i HOME="$HOME" GITHUB_ACTIONS="${GITHUB_ACTIONS:-}" /bin/bash --noprofile --norc << EOF
30-
eval "\$(/usr/libexec/path_helper -s)"
31-
eval "\$("$brew" shellenv)"
32-
HOMEBREW_NO_AUTO_UPDATE=1 "$brew" install chezmoi
33-
chezmoi init --verbose --apply $account
29+
env -i \
30+
HOME="$HOME" \
31+
HOMEBREW_NO_AUTO_UPDATE=1 \
32+
HOMEBREW_PREFIX="${homebrew_dir}" \
33+
GITHUB_ACCOUNT="$account" \
34+
GITHUB_ACTIONS="${GITHUB_ACTIONS:-}" \
35+
/bin/bash --noprofile --norc "$@" << 'EOF'
36+
eval "$(/usr/libexec/path_helper -s)"
37+
eval "$("$HOMEBREW_PREFIX/bin/brew" shellenv)"
38+
"$HOMEBREW_PREFIX/bin/brew" install chezmoi
39+
chezmoi init --verbose --apply "$GITHUB_ACCOUNT"
3440
EOF

0 commit comments

Comments
 (0)