-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·43 lines (36 loc) · 972 Bytes
/
bootstrap.sh
File metadata and controls
executable file
·43 lines (36 loc) · 972 Bytes
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
#!/bin/bash
export DOTFILES_ROOT="${DOTFILES_ROOT:-$HOME/.dotfiles}"
export DOTFILES="${DOTFILES:-$HOME/.dotfiles}"
success_echo() {
echo -e "\033[1;32m[ OK ]\033[0m $*"
}
abort_echo() {
echo -e "\033[1;33mABRT\033[0m $*"
exit 1
}
link_file() {
local old="$1"
local new="$2"
local backup="bkup"
if [ -e "$new" ]; then
local newf
newf=$(readlink "$new")
if [ "$newf" = "$old" ]; then
success_echo "SKIPPED $new -> $old"
return 0
else
mv "$new" "$new.$backup" \
&& success_echo "moved $new to $new.$backup" \
|| abort_echo "failed to backup $new to $new.$backup"
fi
fi
mkdir -p "$(dirname "$new")" \
&& ln -sf "$old" "$new" \
&& success_echo "LINKED $new -> $old" \
|| abort_echo "could not link $new -> $old"
}
link_file "$DOTFILES_ROOT/starship/starship.toml" "$HOME/.config/starship.toml"
source zsh/install.sh
source git/install.sh
source ssh/install.sh
source vscode/install.sh