-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap_sudo.sh
executable file
·102 lines (80 loc) · 1.94 KB
/
bootstrap_sudo.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/sh
function setUp() {
setBrewFormulae
setCask
configureMac
}
function setBrewFormulae() {
fancy_echo "Updating Homebrew formulae ..."
brew update --force # https://github.com/Homebrew/brew/issues/1151
brew bundle --file=- <<EOF
tap "heroku/brew"
# Unix
brew "git"
brew "openssl"
brew "reattach-to-user-namespace"
brew "the_silver_searcher"
brew "tmux"
brew "zsh"
brew "macvim"
brew "tmuxinator"
# Python
brew "python3"
# Other
brew "libyaml" # should come after openssl
# Managements
brew "direnv"
# GPG stuff
brew "gpg2"
# Databases
# brew "postgres", restart_service: :changed
EOF
}
function setCask() {
if brew list | grep -Fq brew-cask; then
fancy_echo "Uninstalling old Homebrew-Cask ..."
brew uninstall --force brew-cask
fi
brew update --force # https://github.com/Homebrew/brew/issues/1151
brew bundle --file=- <<EOF
cask "alfred"
cask "1password"
cask "vlc"
cask "tor"
cask "spectacle"
cask "docker"
cask "alacritty"
cask "little-snitch"
cask "micro-snitch"
cask "expressvpn"
EOF
}
function configureMac() {
sh ~/src/configs/dotfiles/.macos_sudo
}
# Prints
function fancy_echo() {
local fmt="$1"; shift
printf "\n$fmt\n" "$@" $1
}
HOMEBREW_PREFIX="/usr/local"
trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT
set -e
if [ ! -d "$HOME/.bin/" ]; then
mkdir "$HOME/.bin"
fi
if [ -d "$HOMEBREW_PREFIX" ]; then
if ! [ -r "$HOMEBREW_PREFIX" ]; then
sudo chown -R "$LOGNAME:admin" /usr/local
fi
else
sudo mkdir "$HOMEBREW_PREFIX"
sudo chflags norestricted "$HOMEBREW_PREFIX"
sudo chown -R "$LOGNAME:admin" "$HOMEBREW_PREFIX"
fi
cd "$(dirname "$0")/.."
if ! command -v brew >/dev/null; then
fancy_echo "Installing Homebrew ..."
curl -fsS 'https://raw.githubusercontent.com/Homebrew/install/master/install' | ruby
fi
setUp