-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
executable file
·236 lines (204 loc) · 5.53 KB
/
setup.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
#!/usr/bin/env bash
#------------------------
# Install Apt Packages
#------------------------
setup_apt() {
sudo apt update && sudo apt install -y \
build-essential \
cmake \
curl \
git \
vim \
neovim \
python3 \
python3-dev \
python3-pip \
python3-venv \
openssh-server \
openssh-client \
tmux
}
#------------------------
# Install Other Packages
#------------------------
# Tailscale
# https://tailscale.com/download
setup_tailscale() {
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/focal.gpg | sudo apt-key add -
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/focal.list | sudo tee /etc/apt/sources.list.d/tailscale.list
sudo apt update && sudo apt install tailscale
## Authenticate
# sudo tailscale up
## Show Tailscale IP
# ip addr show tailscale0
}
# Rust
# https://www.rust-lang.org/tools/install
setup_rust() {
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
}
# Nim
# https://github.com/dom96/choosenim#unix
setup_nim() {
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
}
# SBCL
# https://lisp-lang.org/learn/getting-started/
setup_sbcl() {
# sudo apt install sbcl
return 1
}
# Guile
# https://www.gnu.org/software/guile/download/
setup_guile() {
# sudo apt install guile-3.0
return 1
}
# Dr. Racket (just handle in Docker?)
# sudo add-apt-repository ppa:plt/racket && sudo apt update && sudo apt install racket
# Haskell
# https://docs.haskellstack.org/en/stable/install_and_upgrade/#ubuntu
setup_haskell() {
# sudo apt install stack -y && stack upgrade
return 1
}
# keybase
## Still kind of an unresolved issue: adding a new device on OS reinstall
setup_keybase() {
# curl --remote-name https://prerelease.keybase.io/keybase_amd64.deb
# sudo apt install ./keybase_amd64.deb
# run_keybase
return 1
}
# Docker
# https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
setup_docker() {
sudo apt remove docker docker-engine docker.io containerd runc
sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update && sudo apt install docker-ce docker-ce-cli containerd.io
# Check if Docker installation succeeded
# sudo docker run hello_world
}
# croc
# https://github.com/schollz/croc
setup_croc() {
curl https://getcroc.schollz.com | bash
}
# nix
# https://nixos.org/download.html
setup_nix() {
curl -L https://nixos.org/nix/install | sh
}
# Chrome
#------------------------
# Link .dotfiles
#------------------------
## Shamelessly taken from https://github.com/tomnomnom/dotfiles/blob/master/setup.sh
dotfilesDir=$(pwd)
function link_dotfile {
dest="${HOME}/${1}"
dateStr=$(date +%Y-%m-%d-%H%M)
if [ -h ~/"${1}" ]; then
# Existing symlink
echo "Removing existing symlink: ${dest}"
rm "${dest}"
elif [ -f "${dest}" ]; then
# Existing file
echo "Backing up existing file: ${dest}"
# shellcheck disable=SC2086
mv ${dest}{,.${dateStr}}
elif [ -d "${dest}" ]; then
# Existing dir
echo "Backing up existing dir: ${dest}"
# shellcheck disable=SC2086
mv ${dest}{,.${dateStr}}
fi
echo "Creating new symlink: ${dest}"
ln -s "${dotfilesDir}/${1}" "${dest}"
}
link_dotfiles() {
#link_dotfile .vim
link_dotfile .vimrc
#link_dotfile .bashrc
#link_dotfile .gitconfig
#link_dotfile .ackrc
#link_dotfile .tmux.conf
#link_dotfile .inputrc
#link_dotfile .xinitrc
#link_dotfile .curlrc
#link_dotfile .gf
}
setup_dotfiles() {
git submodule update --init --recursive
ln -sr "$dotfilesDir/vimrc/.vimrc" "$dotfilesDir/.vimrc"
link_dotfiles
}
setup_vim() {
mkdir -p "$dotfilesDir/.vim/bundle"
cd "$dotfilesDir/.vim/bundle" || exit
git clone git://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall
sudo apt install neovim
}
#------------------------------------
do_thing() {
case $1 in
apt|--apt)
echo "Installing Apt Packages"
setup_apt
;;
rust|--rust)
echo "Installing Rust"
setup_rust
;;
nim|--nim)
echo "Installing Nim"
setup_nim
;;
tailscale|--tailscale)
echo "Installing Tailscale"
setup_tailscale
;;
docker|--docker)
echo "Installing Docker"
setup_docker
;;
croc|--croc)
echo "Installing croc"
setup_croc
;;
nix|--nix)
echo "Installing Nix"
setup_nix
;;
dotfiles|--dotfiles)
echo "Setting up dotfiles"
setup_dotfiles
;;
vim|--vim)
echo "Setting up vim"
setup_vim
;;
*)
echo "Unsupported argument: \"$1\""
;;
esac
}
echo "-----------------------"
echo "Jeremy's computer setup"
echo "-----------------------"
if [ -z "$*" ]
then
echo "Nothing to do"
else
for thing in "$@"
do
do_thing "$thing"
done
fi
#------------------------------------