-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
executable file
·110 lines (94 loc) · 2.55 KB
/
setup.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
#!/bin/bash
cd "$(dirname "$0")"
has() {
command -v "$1" >/dev/null
}
confirm() {
local result
read -p "$1 (y/n) " -n 1 result
echo
test "$result" == y
}
install_nf() {
local name="${1?missing name}"
(
cd "$(mktemp -d)"
wget "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/$name.zip"
unzip "$name.zip"
mkdir -p ~/.local/share/fonts
mv *.ttf ~/.local/share/fonts
fc-cache -f
)
}
if has apt; then
echo "apt found"
if confirm "would you like to install system deps?"; then
sudo apt update
sudo apt install build-essential git tmux zsh stow curl wget zip unzip ffmpeg imagemagick rofi xclip xdotool playerctl jq conky
fi
fi
if ! has stow; then
echo "missing GNU stow, please install first" >&2
exit 1
fi
if ! has zsh; then
echo "missing zsh, please install first" >&2
exit 1
fi
if [[ "$SHELL" != *zsh ]]; then
echo "current user shell is not zsh"
if confirm "change it to $(which zsh)?"; then
chsh -s $(which zsh)
echo "please relog for this change to be reflected"
fi
fi
if ! has mise; then
echo "mise not found"
if confirm "would you like to install it?"; then
curl https://mise.run | sh
fi
fi
mise_deps=("neovim" "starship" "pnpm" "node@lts")
if has mise && confirm "would you like to install (${mise_deps[*]}) with mise?"; then
mise use -g "${mise_deps[@]}"
eval "$(mise env)"
fi
if ! has starship; then
echo "starship not found"
if confirm "install starship?"; then
curl -sS https://starship.rs/install.sh | sh
fi
fi
if ! has nvim; then
echo "neovim not found"
if confirm "install neovim?"; then
(
cd "$(mktemp -d)"
wget "https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz"
tar -xzvf nvim-linux64.tar.gz
sudo rsync -abu nvim-linux64/ /usr/local/
)
fi
fi
if ! has pnpm; then
echo "pnpm not found"
if confirm "install pnpm?"; then
# hide the current shell info so it doesnt install completions bc AAAAA
curl -fsSL https://get.pnpm.io/install.sh | env SHELL="" BASH_VERSION="" ZSH_VERSION="" sh -
fi
fi
if ! has fc-list; then
echo "cant manage fonts on this system, ignoring"
else
if ! fc-list | grep -q "FiraCode Nerd Font"; then
echo "FiraCode Nerd Font not installed"
confirm "install it?" && install_nf FiraCode
fi
if ! fc-list | grep -q "Iosevka Nerd Font"; then
echo "Iosevka Nerd Font not installed"
confirm "install it?" && install_nf Iosevka
fi
fi
default_stows=(zsh scripts tmux git nvim)
echo "installing default stows: ${default_stows[@]}"
./stow.sh "${default_stows[@]}"