-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbootstrap.sh
executable file
·114 lines (91 loc) · 2.48 KB
/
bootstrap.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
#!/bin/bash
# This script creates symlinks from the home directory to the various dotfiles in ~/.dot-files
heading () {
echo ""
echo "*******************************************************************************"
echo "$1"
echo "*******************************************************************************"
}
heading "Backing up and linking dot files..."
dotfiles_dir=~/.dot-files
date=`date +%Y-%m-%d--%H-%M-%S`
backupdir=~/${dotfiles_dir}.bak/$date
function backup_file {
srcFile="$HOME/${1}"
mv "${srcFile}" "${backupdir}"
}
function link_file {
file="${1}"
ln -s "$(pwd)/${file}" "${HOME}/${file}"
}
while IFS= read -r slug || [[ -n "$slug" ]]; do
if [[ ! -L "${HOME}/${slug}" ]]; then
backup_file $slug
link_file $slug
else
echo "Skipping: ${slug}"
fi
done <<EOF
.bash_aliases
.bash_prompt
.bashrc
.emacs.d
.gitconfig
.inputrc
.profile
.sqliterc
.tmux.conf
.vim
.zshrc
EOF
if [ -d "$HOME/.oh-my-zsh" -a ! -h "$HOME/.oh-my-zsh" ]
then
echo "Skipping: Oh My Zsh already exists."
else
echo "Cloning Oh My Zsh."
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
fi
if [ -d "$HOME/.fzf" -a ! -h "$HOME/.fzf" ]
then
echo "Skipping: FZF already installed."
else
echo "Cloning FZF"
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install
fi
if [ -d "$HOME/.cargo" ]; then
echo "Skipping: Rust already installed."
else
echo "Installing Rust Cargo"
curl https://sh.rustup.rs -sSf | sh
fi
if [ -f "$HOME/.vim/autoload/plug.vim" -a ! -h "$HOME/.vim/autoload/plug.vim" ]
then
echo "Skipping: Vim Plug already installed."
else
echo "Cloning Vim Plug"
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
## Ensure apps
heading "Installing Nerd Fonts"
## Ensure Fonts
install_nerd_font () {
nerd_font_name="$1"
nerd_font_version="v3.1.1"
# TODO: guard for already existing font
echo "Installing ${nerd_font_name}"
(
mkdir -p ~/.fonts
cd ~/.fonts
curl -fLo "${nerd_font_name}.zip" \
"https://github.com/ryanoasis/nerd-fonts/releases/download/${nerd_font_version}/${nerd_font_name}.zip" \
&& unzip -d "${nerd_font_name}" "${nerd_font_name}.zip" \
&& mv "${nerd_font_name}/"*.ttf ./ \
&& rm "${nerd_font_name}.zip"
)
}
install_nerd_font "JetBrainsMono"
install_nerd_font "SourceCodePro" # wtf, SauceCodePro?
fc-cache -f -v
heading "Ensure required apps are installed"
sudo apt install git git-lfs direnv wget tmux jq pandoc build-essential