-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·65 lines (54 loc) · 1.73 KB
/
install.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
#!/usr/bin/env bash
set -e
os=$(uname -s)
packages=(
curl
git
tmux
vim
zsh
rsync
xz-utils # Required by proto
)
# Install packages on supported platforms
if [[ "$os" == "Linux" ]]; then
sudo apt-get update
sudo apt-get install -y "${packages[@]}"
fi
# Create directories for configs and binaries
mkdir -p "$HOME/.proto"
mkdir -p "$HOME/.config"
mkdir -p "$HOME/.local/bin"
# Clone dotfiles repo
clone_directory="$HOME/dotfiles"
# Useful when developing locally
if [ "$DEBUG" = "true" ]; then
rsync -ahP "$PWD/" "$clone_directory"
else
git clone https://github.com/Trugamr/dotfiles.git "$clone_directory"
fi
# Create symlinks to config files
ln -fs "$clone_directory/.proto/.prototools" "$HOME/.proto/.prototools"
ln -fs "$clone_directory/.config/starship.toml" "$HOME/.config/starship.toml"
ln -fs "$clone_directory/.gitconfig" "$HOME/.gitconfig"
ln -fs "$clone_directory/.hushlogin" "$HOME/.hushlogin"
ln -fs "$clone_directory/.tmux.conf" "$HOME/.tmux.conf"
ln -fs "$clone_directory/.vimrc" "$HOME/.vimrc"
ln -fs "$clone_directory/.zshrc" "$HOME/.zshrc"
# Install proto to manage tooling versions
if ! command -v proto &> /dev/null; then
curl -fsSL https://moonrepo.dev/install/proto.sh | bash -s -- --no-modify-profile --no-modify-path --yes --version 0.41.5
fi
# Install latest LTS version of node using proto
if ! command -v node &> /dev/null; then
# Proto uses "proto" itself from path to install npm
PATH="$HOME/.proto/bin:$PATH" proto install node lts
fi
# Install starship prompt (https://starship.rs/)
if ! command -v starship &> /dev/null; then
curl -sS https://starship.rs/install.sh | sudo sh -s -- --yes
fi
# Change default shell to zsh
if [[ "$os" == "Linux" ]]; then
sudo chsh -s "$(command -v zsh)" "$USER"
fi