-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_once_before_install-packages-darwin.zsh.tmpl
executable file
·124 lines (109 loc) · 3.67 KB
/
run_once_before_install-packages-darwin.zsh.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
{{ if (eq .chezmoi.os "darwin") -}}
#!/bin/zsh
if ! command -v brew &> /dev/null
then
script_path=~/.local/share/chezmoi/
sudo xcodebuild -license accept
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" || true
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
brew bundle --file=$script_path/private_dot_config/Brewfile || true
brew link node
if test -d /opt/homebrew; then
HOMEBREW_HOME=/opt/homebrew
elif test -d /home/linuxbrew/.linuxbrew; then
HOMEBREW_HOME=/home/linuxbrew/.linuxbrew
else
HOMEBREW_HOME=/usr/local
fi
if ! grep -q fish /etc/shells; then
sudo sh -c "echo $HOMEBREW_HOME/bin/fish >> /etc/shells"
chsh -s $HOMEBREW_HOME/bin/fish
fi
if ! command -v uname &> /dev/null
then
sudo ln -s $HOMEBREW_HOME/opt/coreutils/bin/guname /usr/local/bin/uname
fi
# `fish_config` then set lava
set -U fish_color_normal normal
set -U fish_color_command FF9400
set -U fish_color_quote BF9C30
set -U fish_color_redirection BF5B30
set -U fish_color_end FF4C00
set -U fish_color_error FFDD73
set -U fish_color_param FFC000
set -U fish_color_comment A63100
set -U fish_color_match --background=brblue
set -U fish_color_selection white --bold --background=brblack
set -U fish_color_search_match bryellow --background=brblack
set -U fish_color_history_current --bold
set -U fish_color_operator 00a6b2
set -U fish_color_escape 00a6b2
set -U fish_color_cwd green
set -U fish_color_cwd_root red
set -U fish_color_valid_path --underline
set -U fish_color_autosuggestion FFC473
set -U fish_color_user brgreen
set -U fish_color_host normal
set -U fish_color_cancel -r
set -U fish_pager_color_completion normal
set -U fish_pager_color_description B3A06D yellow
set -U fish_pager_color_prefix white --bold --underline
set -U fish_pager_color_progress brwhite --background=cyan
chmod +x $script_path/mac_defaults.sh
$script_path/mac_defaults.sh
chmod +x $script_path/private_dot_config/private_fish/fish_theme.fish
$script_path/private_dot_config/private_fish/fish_theme.fish
curl -L https://iterm2.com/shell_integration/fish -o ~/.iterm2_shell_integration.fish
bw config server "{{ .bwserver }}"
bw login
exit 0
fi
echo "Brew already installed. Update.."
INSTALLED_FORMULAE=(`brew list --formula --quiet | sort -r`)
INSTALLED_CASK=(`brew list --cask --quiet | sort -r`)
if command -v gsed &> /dev/null
then
SED=gsed
else
SED=sed
fi
SAVED_CASK=(`cat ~/.config/Brewfile | grep -v -E "^(tap|mas|brew)" | $SED -E 's@^cask\s+\"@@' | $SED s@'".*$@@' | sort`)
SAVED_FORMULAE=(`cat ~/.config/Brewfile | grep -v -E "^(tap|mas|cask)" | $SED -E 's@^brew\s+\"@@' | $SED s@'".*$@@' | sort`)
CASK=("${SAVED_CASK}")
for element in "${INSTALLED_CASK[@]}"; do
CASK=(${CASK[@]/$element})
done
typeset -A del_formulae
FORMULAE=()
for element in "${INSTALLED_FORMULAE[@]}"; do
del_formulae[$element]=1
done
for k in "${SAVED_FORMULAE[@]}"; do
if [[ ! "${del_formulae[$k]}" ]]; then
FORMULAE=($k)
fi
done
typeset -A del_cask
CASK=()
for element in "${INSTALLED_CASK[@]}"; do
del_cask[$element]=1
done
for k in "${SAVED_CASK[@]}"; do
if [[ ! "${del_cask[$k]}" ]]; then
CASK=($k)
fi
done
if [ ${#FORMULAE[@]} -gt 0 ]; then
set -x
brew install "${FORMULAE[@]}"
set +x
fi
if [ ${#CASK[@]} -gt 0 ]; then
set -x
brew install --cask "${CASK[@]}"
set +x
fi
# run_once hash: {{ include "private_dot_config/Brewfile" | sha256sum }}
# vi: ft=fish
{{ end -}}