-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-linux.sh
executable file
·145 lines (112 loc) · 3.38 KB
/
setup-linux.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/usr/bin/env bash
CMD=$(realpath "${0}")
CUR_DIR=$(dirname "${CMD}")
# shellcheck source=scripts/utils.sh
source "${CUR_DIR}"/scripts/utils.sh
# shellcheck source=scripts/setup_shell.sh
source "${CUR_DIR}"/scripts/setup_shell.sh
if command -v eza &>/dev/null; then
cargo install eza
fi
if command -v bat &>/dev/null; then
cargo install bat
fi
if command -v fd &>/dev/null; then
cargo install fd-find
fi
if command -v rg &>/dev/null; then
cargo install ripgrep
fi
if ! command -v dprint >/dev/null 2>&1; then
cargo install dprint
fi
if ! command -v stylua >/dev/null 2>&1; then
cargo install stylua
fi
if ! command -v git-delta >/dev/null 2>&1; then
cargo install git-delta
fi
if ! command -v cargo-bloat >/dev/null 2>&1; then
cargo install cargo-bloat
fi
if ! command -v cargo-bump >/dev/null 2>&1; then
cargo install cargo-bump
fi
if ! command -v cargo-update >/dev/null 2>&1; then
cargo install cargo-update
fi
if ! command -v dysk >/dev/null 2>&1; then
cargo install dysk
fi
if ! command -v fcp >/dev/null 2>&1; then
cargo install fcp
fi
# Install diff-so-fancy: {{{
if ! command -v diff-so-fancy >/dev/null 2>&1; then
echo "Setting up diff-so-fancy..."
diff_so_fancy_version=$(get_git_version "so-fancy/diff-so-fancy")
curl -sLo ./diff-so-fancy https://github.com/so-fancy/diff-so-fancy/releases/download/"${diff_so_fancy_version}"/diff-so-fancy
chmod a+x ./diff-so-fancy
sudo mv ./diff-so-fancy /usr/local/bin/diff-so-fancy
fi
# }}}
# Install btop
ARCH=$(uname -m)
if ! command -v btop &>/dev/null; then
if [[ $(get_ubuntu_version) -lt 23 ]]; then
if [ "${ARCH}" = "x86_64" ]; then
sudo cp -f "${CUR_DIR}"/prebuilts/btop-x86_64 /usr/local/bin/btop
elif [ "${ARCH}" = "aarch64" ]; then
sudo cp -f "${CUR_DIR}"/prebuilts/btop-aarch64 /usr/local/bin/btop
else
echo "btop not available for ${ARCH}"
fi
else
sudo apt install -y btop
fi
fi
# NVIM configuration: {{{
curl -sLo ./nvim https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod a+x ./nvim
CUSTOM_NVIM_PATH=/usr/local/bin/nvim
sudo mv ./nvim ${CUSTOM_NVIM_PATH}
set -u
sudo update-alternatives --install /usr/bin/ex ex "${CUSTOM_NVIM_PATH}" 110
sudo update-alternatives --install /usr/bin/vi vi "${CUSTOM_NVIM_PATH}" 110
sudo update-alternatives --install /usr/bin/view view "${CUSTOM_NVIM_PATH}" 110
sudo update-alternatives --install /usr/bin/vim vim "${CUSTOM_NVIM_PATH}" 110
sudo update-alternatives --install /usr/bin/vimdiff vimdiff "${CUSTOM_NVIM_PATH}" 110
if [ ! -d /root/.config ]; then
sudo mkdir -p /root/.config
fi
if [ ! -d /root/.config/nvim ]; then
sudo cp -afr ~/.config/nvim/ /root/.config/nvim
fi
# run packersync
nvim --headless +PackerSync +qa
# }}}
# Configure zsh: {{{
sudo chsh "$(whoami)" -s "$(which zsh)"
sudo chsh -s "$(which zsh)"
if [ ! -d /root/.config/zsh ]; then
sudo cp -afr ~/.config/zsh/ /root/.config/zsh
fi
# shellcheck disable=SC1090
source ~/.zshrc
# }}}
# Setup fonts: {{{
if [ ! -d "${HOME}"/.local/share/fonts ]; then
mkdir -p "${HOME}"/.local/share/fonts
fi
unzip "${CUR_DIR}"/ubuntu/FireCode.zip -d "${HOME}"/.local/share/fonts
unzip "${CUR_DIR}"/ubuntu/Twilio-Sans-Mono.zip -d "${HOME}"/.local/share/fonts
fc-cache -f -v
# }}}
# Install nodejs
if [[ $(get_ubuntu_version) -lt 22 ]]; then
curl -fsSL https://deb.nodesource.com/setup_19.x | sudo -E bash -
sudo apt-get install -y nodejs npm
else
sudo apt-get install -y nodejs npm
fi
exec $(which zsh)