-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
79 lines (64 loc) · 1.62 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
#!/bin/bash
set -e
set -u
RCol='\033[0m'
Gre='\033[0;32m'
Red='\033[0;31m'
Yel='\033[0;33m'
## printing functions ##
function gecho {
echo "${Gre}[message] $1${RCol}"
}
function yecho {
echo "${Yel}[warning] $1${RCol}"
}
function wecho {
# red, but don't exit 1
echo "${Red}[error] $1${RCol}"
}
function recho {
echo "${Red}[error] $1${RCol}"
exit 1
}
## install functions ##
# check for pre-req, fail if not found
function check_preq {
(command -v $1 > /dev/null && gecho "$1 found...") ||
recho "$1 not found, install before proceeding."
}
# look for command line tool, if not install via homebrew
function install_brew {
(command -v $1 > /dev/null && gecho "$1 found...") ||
(yecho "$1 not found, installing via homebrew..." && brew install $1)
}
# function for linking dotfiles
function linkdotfile {
file="$1"
if [ ! -e ~/$file -a ! -L ~/$file ]; then
yecho "$file not found, linking..." >&2
ln -s ~/dotfiles/$file ~/$file
else
gecho "$file found, ignoring..." >&2
fi
}
# are we in right directory?
[[ $(basename $(pwd)) == "dotfiles" ]] ||
recho "doesn't look like you're in dotfiles/"
# check that the key pre-requisites are met:
check_preq gcc
check_preq brew
check_preq "command -v ~/anaconda/bin/conda"
# install Homebrew main programs
install_brew ag
install_brew tmux
install_brew ripgrep
install_brew coreutils
install_brew cmake
install_brew neovim
install_brew pnpm
install_brew fzf
touch ~/.profile
linkdotfile zsh/.zshrc
linkdotfile zsh/.zprofile
echo "Install fonts RobotoMono + Source Code Pro + Hacknerd + Victormono"
curl -fsSL https://get.pnpm.io/install.sh | sh -