forked from huygn/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
30_osx_homebrew_recipes.sh
76 lines (68 loc) · 1.68 KB
/
30_osx_homebrew_recipes.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
# OSX-only stuff. Abort if not OSX.
is_osx || return 1
# Exit if Homebrew is not installed.
[[ ! "$(type -P brew)" ]] && e_error "Brew recipes need Homebrew to install." && return 1
# Homebrew recipes
recipes=(
android-platform-tools
ansible
bash
cmake
cowsay
fish
fzf
git
git-extras
glide
go
heroku
htop-osx
hub
id3tool
jq
lesspipe
m-cli
man2html
mercurial
ncdu
nmap
node
rust
sl
ssh-copy-id
terminal-notifier
the_silver_searcher
thefuck
tree
vim
watchman
wget
yarn
zsh
zsh-syntax-highlighting
)
brew_install_recipes
# Misc cleanup!
# This is where brew stores its binary symlinks
local binroot="$(brew --config | awk '/HOMEBREW_PREFIX/ {print $2}')"/bin
# htop
if [[ "$(type -P $binroot/htop)" ]] && [[ "$(stat -L -f "%Su:%Sg" "$binroot/htop")" != "root:wheel" || ! "$(($(stat -L -f "%DMp" "$binroot/htop") & 4))" ]]; then
e_header "Updating htop permissions"
sudo chown root:wheel "$binroot/htop"
sudo chmod u+s "$binroot/htop"
fi
# bash
if [[ "$(type -P $binroot/bash)" && "$(cat /etc/shells | grep -q "$binroot/bash")" ]]; then
e_header "Adding $binroot/bash to the list of acceptable shells"
echo "$binroot/bash" | sudo tee -a /etc/shells >/dev/null
fi
# zsh
if [[ "$(type -P $binroot/zsh)" && "$(cat /etc/shells | grep -q "$binroot/zsh")" ]]; then
e_header "Adding $binroot/zsh to the list of acceptable shells"
echo "$binroot/zsh" | sudo tee -a /etc/shells >/dev/null
fi
if [[ "$(dscl . -read ~ UserShell | awk '{print $2}')" != "$binroot/zsh" ]]; then
e_header "Making $binroot/zsh your default shell"
sudo chsh -s "$binroot/zsh" "$USER" >/dev/null 2>&1
e_arrow "Please exit and restart all your shells."
fi