Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·206 lines (169 loc) · 7.07 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·206 lines (169 loc) · 7.07 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#!/usr/bin/env bash
set -e
source "scripts/util.sh"
BOLD=$(tput bold)
SGR0=$(tput sgr0)
install_dnf() {
echo "Not implemented yet!"
exit 1
}
install_apt() {
# sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y curl wget build-essential g++ gdb automake autoconf libtool pkg-config make xsel libreadline-dev unzip p7zip-full
}
install_pacman() {
sudo pacman -Sy
sudo pacman -S --needed --noconfirm curl wget gcc gdb automake autoconf libtool pkg-config make git subversion xsel python-pip patch clang llvm rustup cmake ninja zsh nushell starship tmux fzf ripgrep-all fd vim neovim node npm universal-ctags z.lua luajit luarocks direnv carapace pixi imagemagick tree-sitter-cli unzip p7zip-full
}
install_linux() {
distname=$(cat /etc/*release | sed -ne 's/DISTRIB_ID=\(.*\)/\1/gp')
distver=$(cat /etc/*release | sed -ne 's/DISTRIB_RELEASE=\(.*\)/\1/gp')
machine=$(uname -m)
case $distname in
Ubuntu) install_apt ;;
Debian) install_apt ;;
Fedora) install_dnf ;;
CentOS) install_dnf ;;
Arch) install_pacman ;;
*)
if [[ "$distname" = "" ]]; then
echo "Your distribution is not supported!"
else
echo "$distname is not supported!"
fi
exit 1
;;
esac
# Fix for vim
if [[ -e ~/.viminfo ]]; then
sudo chown "$USER:$(id -g -n $USER)" "$HOME/.viminfo"
fi
mkdir -p ~/.local/share/fonts
curl https://github.com/subframe7536/maple-font/releases/latest/download/MapleMono-NF-CN-unhinted.zip | unzip -o -d ~/.local/share/fonts/ -
curl https://github.com/lxgw/LxgwBright-Code/releases/latest/download/LxgwBrightCode.7z | 7zr x -o~/.local/share/fonts/
curl https://github.com/lxgw/LxgwBright-Code/releases/latest/download/LxgwBrightCodeGB.7z | 7zr x -o~/.local/share/fonts/
curl https://github.com/lxgw/LxgwBright-Code/releases/latest/download/LxgwBrightCodeTC.7z | 7zr x -o~/.local/share/fonts/
curl https://github.com/ryanoasis/nerd-fonts/releases/latest/download/NerdFontsSymbolsOnly.zip | unzip -o -d ~/.local/share/fonts/ -
curl https://github.com/rbong/flog-symbols/raw/refs/heads/main/FlogSymbols.ttf -o ~/.local/share/fonts/FlogSymbols.ttf
fc-cache
if [[ $distname != "Arch" ]]; then
ln -sf "$PWD/local/bin/brew" "$HOME/.local/bin"
# Install Homebrew for Linux
if [[ -x /home/linuxbrew/.linuxbrew/bin/brew ]]; then
sudo useradd linuxbrew || true
sudo adduser $USER linuxbrew || true
sudo chown -R linuxbrew:linuxbrew /home/linuxbrew
brew update
else
sudo useradd linuxbrew || true
sudo adduser $USER linuxbrew || true
sudo mkdir -p /home/linuxbrew
sudo git clone --recursive https://github.com/Homebrew/brew.git /home/linuxbrew/.linuxbrew/Homebrew
sudo mkdir -p /home/linuxbrew/.linuxbrew/bin
sudo ln -s /home/linuxbrew/.linuxbrew/Homebrew/bin/brew /home/linuxbrew/.linuxbrew/bin
sudo chown -R linuxbrew:linuxbrew /home/linuxbrew
fi
sudo -H -u linuxbrew mkdir -p /home/linuxbrew/.linuxbrew/etc
sudo -H -u linuxbrew ln -fs /etc/localtime /home/linuxbrew/.linuxbrew/etc/localtime
#sudo -H -u linuxbrew /home/linuxbrew/.linuxbrew/opt/glibc/bin/localedef -i zh_CN -f UTF-8 zh_CN.UTF-8
fi
}
function install_mac() {
if type brew &> /dev/null; then
brew update
else
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
brew install coreutils gnu-sed gawk make automake autoconf libtool pkg-config cmake ninja git git-lfs reattach-to-user-namespace wezterm@nightly font-maple-mono-nf-cn font-symbols-only-nerd-font
brew install --cask macvim-app neovide-app mactex
brew tap daipeihust/tap
brew install im-select
}
if [[ $(id -u) -eq 0 ]] || [[ $(id -g) -eq 0 ]]; then
echo "Please do not run this script as root."
exit 1
fi
mkdir -p "$HOME/.local/bin"
export PATH=$HOME/.local/bin:$PATH
UNAME_S=$(uname -s)
if [[ $http_proxy == "" || $https_proxy == "" ]]; then
ask_setup_proxy
fi
case $UNAME_S in
Linux)
install_linux
;;
Darwin)
install_mac
;;
*)
echo "$UNAME_S is not supported!"
exit 1
;;
esac
if type brew &>/dev/null; then
export HOMEBREW_PREFIX="$(brew --prefix)"
brew install git git-lfs subversion rustup-init cmake ninja zsh tmux nushell starship z.lua fzf ripgrep-all fd vim luajit luarocks direnv carapace pixi universal-ctags global neovim imagemagick tree-sitter-cli gh node npm rust rustup pi-coding-agent plantuml gnuplot d2 graphviz librsvg
fi
if [[ $HOMEBREW_PREFIX != "" && -s "$HOMEBREW_PREFIX/bin/rustup-init" ]]; then
"$HOMEBREW_PREFIX/bin/rustup-init" -y
else
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
fi
[[ -s "$HOME/.cargo/env" ]] && source "$HOME/.cargo/env"
rustup update
rustup component add rust-src
if type brew &>/dev/null; then
scripts/linuxbrew_post_install.sh
fi
if [[ $UNAME_S = "Linux" ]]; then
ln -sf /home/linuxbrew/.linuxbrew/bin/pixi "$HOME/.local/bin"
fi
pixi global install -e default python pip numpy scipy matplotlib librosa jupyter ipython jupyterlab pynvim uv sympy pandas scikit-learn numba
if [[ $UNAME_S = "Linux" ]]; then
pixi global install -e default pytorch pytorch-gpu torchaudio cuda cudnn
else
pixi global install -e default install pytorch torchaudio
fi
# if [[ -s "/usr/share/nvm/init-nvm.sh" ]]; then
# source /usr/share/nvm/init-nvm.sh
# else
# export NVM_DIR="$HOME/.nvm"
# [[ -s "$HOMEBREW_PREFIX/opt/nvm/nvm.sh" ]] && . "$HOMEBREW_PREFIX/opt/nvm/nvm.sh" # This loads nvm
# [[ -s "$HOMEBREW_PREFIX/opt/nvm/etc/bash_completion.d/nvm" ]] && . "$HOMEBREW_PREFIX/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
# fi
#
# nvm install node npm
# nvm use node
# nvm alias default $(nvm current)
npm install -g @mermaid-js/mermaid-cli
# gem install --user-install neovim
npm install -g neovim
mkdir -p ~/.local/share/tmux/plugins
if [[ -r ~/.local/share/tmux/plugins/tpm && -d ~/.local/share/tmux/plugins/tpm ]]; then
pushd ~/.local/share/tmux/plugins/tpm
git pull
popd
else
git clone --recursive https://github.com/tmux-plugins/tpm ~/.local/share/tmux/plugins/tpm
fi
if [[ -r ~/.zgen && -d ~/.zgen ]]; then
pushd ~/.zgen
git pull
popd
else
git clone https://github.com/tarjoilija/zgen.git ~/.zgen
fi
rm -f .zgen/init.zsh
# scripts/disable_sudo_secure_path.sh
scripts/link.sh
if [[ "$UNAME_S" = "Linux" ]]; then
sudo chmod g-w /home/linuxbrew/.linuxbrew/share/zsh/site-functions /home/linuxbrew/.linuxbrew/share/zsh
fi
if [[ $HOMEBREW_PREFIX != "" && -s "$HOMEBREW_PREFIX/opt/fzf/install" ]]; then
zsh -c "$HOMEBREW_PREFIX/opt/fzf/install --all --no-update-rc --no-fish"
fi
echo "Congratulations! The installation is finished."
echo "It is ${BOLD}strongly recommended${SGR0} that you log out from your current shell and log in again ${BOLD}now${SGR0}."
# vim: ts=8 sts=4 sw=4 et