-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap-linux.sh
More file actions
executable file
·31 lines (26 loc) · 951 Bytes
/
bootstrap-linux.sh
File metadata and controls
executable file
·31 lines (26 loc) · 951 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
#!/bin/bash
machine_role="$1"
dotfiles_home=$(realpath $(dirname $0))
declare -a files
if [ -f /.dockerenv ]; then
files+=(".bash_profile" ".bash_prompt" ".bashrc" ".inputrc" ".vimrc" ".zshenv" ".zshrc")
else
files+=(".bash_profile" ".bash_prompt" ".bashrc" ".gitconfig" ".inputrc" ".vimrc" ".zshenv" ".zshrc")
if command -v code >/dev/null; then
code --force --install-extension vscodevim.vim
code --force --install-extension streetsidesoftware.code-spell-checker
fi
fi
for f in "${files[@]}"; do
if [ -e "${dotfiles_home}"/"${machine_role}"/"${f}" ]; then
source_file="${dotfiles_home}"/"${machine_role}"/"${f}"
echo "Using ${machine_role} override for ${f}"
elif [ -e "${dotfiles_home}"/"${f}" ]; then
source_file="${dotfiles_home}"/"${f}"
echo "Using default for ${f}"
else
echo "Could not locate source file ${f}, skipping"
continue
fi
(cd "${HOME}" && ln -nsf "${source_file}" "${f}")
done