-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap
executable file
·73 lines (52 loc) · 1.48 KB
/
bootstrap
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
#!/usr/bin/env bash
DOTFILES_PATH=$(dirname "$(realpath "${BASH_SOURCE[0]}")")
export DOTFILES
cd "${DOTFILES_PATH}" || exit
if command -v sudo &> /dev/null; then
sudo -v
while true; do
sudo -n true
sleep 300
kill -0 "$$" || exit
done 2> /dev/null &
fi
# link required files to home directory
. "${DOTFILES_PATH}/bin/sync_dotfiles"
. "${HOME}/.bash_profile"
# shellcheck disable=SC1090
. "${DOTFILES_PATH}/.init/${PLATFORM-}"
. "${DOTFILES_PATH}/.init/install_homebrew"
# use homebrew bash on macos
if [[ ${PLATFORM-} == "darwin" ]]; then
hb_bash="${HOMEBREW_PREFIX}/opt/bin/bash" || "$(command -v bash)"
if ! grep "${hb_bash}" /etc/shells &> /dev/null; then
echo
echo "Setting \$SHELL to ${hb_bash}"
echo
echo "${hb_bash}" | sudo tee -a /etc/shells &> /dev/null
sudo chsh -s "${hb_bash}" "${USER}" &> /dev/null
# verify
grep "^${USER}" /etc/passwd &> /dev/null || exit 127
echo "done"
echo
fi
fi
# shellcheck source=../bin/update_system
. "${HOME}/bin/update_system"
echo "bootsrapping asdf"
echo
# shellcheck disable=SC1091
if ! command -v asdf &> /dev/null; then
git clone https://github.com/asdf-vm/asdf.git "${HOME}/.asdf" --branch v0.14.1
. "${HOME}/.asdf/asdf.sh"
. "${HOME}/.asdf/completions/asdf.bash"
fi
if command -v asdf &> /dev/null; then
plugins=$(awk '{print $1}' < "${HOME}/.tool-versions" | tr '\n' ' ')
for plugin in ${plugins}; do
asdf plugin add "${plugin}"
done
asdf install
fi
echo "done!"
echo