-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·80 lines (69 loc) · 1.49 KB
/
install.sh
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
#!/bin/bash
function yes-no() {
read -p "$1 [y/n]" -n 1 -r
echo '' # make sure we're on a newline
[ $REPLY == "y" ] && return 0 || return 1
}
if [[ ! $(xcode-select -p) ]]; then
$(xcode-select --install)
yes-no 'Did Xcode install successfully?' || exit 1
fi
if [[ ! -x /usr/local/bin/brew ]]; then
echo "Install homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
if [[ ! -x ~/.tmux/plugins/tpm ]]; then
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
function brew-all {
function may-brew {
printf "%-50s" $1
if brew ${assert} -1 | grep -q $(echo $1 | sed 's/caskroom\/cask\///'); then
printf "%30s\n" '[OK]'
else
printf "%30s\n\n" '[INSTALLING]'
brew ${action} $1
printf "\n\n"
fi
return 0
}
function many-brew {
printf "\nbrew $2\n\n"
local assert=$1
local action=$2
for item in ${brews[@]}; do
may-brew $item
done
}
local brews=(
caskroom/fonts
)
many-brew 'tap' 'tap'
local brews=(
autojump
cloc
ctags
curl
fzf
git
grep
imagesnap
readline
reattach-to-user-namespace
ripgrep
ruby-build
ruby-install
tmux
vim
zsh
)
many-brew 'list' 'install'
} && brew-all
cd lib
for entry in *; do
ln -Ffs .dotfiles/lib/$entry $HOME/.$entry
done
cd ..
ln -Ffs .dotfiles/id_rsa.pub $HOME/.ssh/.id_rsa.pub
sudo chsh -s "$(command -v zsh)" "${USER}"
chsh -s "$(which zsh)"