-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·139 lines (113 loc) · 3.41 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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
# Set the working directory to where the file is.
cd "$(dirname "$0")" || return
case $(uname -s) in
Darwin) OS=darwin ;;
Linux) OS=linux ;;
*) echo "Unsupport OS $(uname -s)"; exit 1 ;;
esac
# run echoes and runs.
run() {
echo "$@" && "$@"
}
git config --global user.email "stephen@stephenwan.com"
git config --global user.name "Stephen Wan"
case $OS in
darwin)
echo Setting up mac defaults...
# Pointer
defaults write -g com.apple.trackpad.scaling 0.875
defaults write -g com.apple.mouse.scaling -1
# Keyboard
defaults write -g ApplePressAndHoldEnabled -bool false
defaults write -g NSWindowShouldDragOnGesture -bool true
defaults write -g InitialKeyRepeat -int 15
defaults write -g KeyRepeat -int 1
# Dock
defaults write com.apple.dock persistent-apps -array
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock show-recents -bool FALSE
# Keyboard
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 # Support tabbing between any controls.
# brew installation will also add basic xcode tools (git).
echo Checking if brew installed...
if ! which brew >/dev/null 2>&1; then
echo Installing brew.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/stephen/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
if [[ ! -f ~/.ssh/id_rsa ]]; then
ssh-keygen -t rsa -b 4096 -C "stephen@stephenwan.com" -P "" -f ~/.ssh/id_rsa
fi
echo Installing apps from homebrew...
run brew update
run brew bundle -v --file=- <<-EOF
tap "homebrew/cask-versions"
cask "google-chrome-canary"
cask "unnaturalscrollwheels"
tap "spotify/public"
cask "spotify"
brew "lnav"
brew "stripe/stripe-cli/stripe"
brew "golang"
brew "node"
brew "direnv"
brew "git"
brew "mosh"
brew "watchman"
brew "jq"
brew "mas"
brew "coreutils"
brew "fasd"
cask "docker"
cask "lunar"
cask "shifty"
brew "ctop"
cask "vlc"
cask "visual-studio-code"
cask "rectangle"
cask "iterm2"
cask "flux"
cask "ngrok"
cask "licecap"
EOF
echo Installing apps from Mac App Store...
run mas install 1451685025 # wireguard
run mas install 775737590 # ia writer
run mas install 425424353 # unarchiver
run mas install 1475387142 # tailscale
;;
linux)
curl -fsSL https://pkgs.tailscale.com/stable/debian/buster.gpg | sudo apt-key add -
curl -fsSL https://pkgs.tailscale.com/stable/debian/buster.list | sudo tee /etc/apt/sources.list.d/tailscale.list
run sudo apt-get update
run sudo apt-get install -y \
mosh \
zsh \
tmux \
fasd \
tailscale
esac
if [[ ! -d ~/.oh-my-zsh ]]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
chsh -s $(which zsh)
fi
echo Installing fzf...
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install --all
echo Symlinking configurations into home...
case $OS in
darwin)
run ln -fsv "$(greadlink -f ./configs/com.knollsoft.Rectangle.plist)" ~/Library/Preferences/
run ln -fsv "$(greadlink -f .gitconfig)" ~
run ln -fsv "$(greadlink -f ./configs/.zshrc)" ~
run ln -fsv "$(greadlink -f ./bin)" ~
# Setup iterm2
defaults write com.googlecode.iterm2.plist PrefsCustomFolder -string "$HOME/git/dotfiles/configs/iterm2"
defaults write com.googlecode.iterm2.plist LoadPrefsFromCustomFolder -bool true
;;
linux)
run ln -fsv "$(readlink -f .gitconfig)" ~
run ln -fsv "$(readlink -f ./bin)" ~
esac