Code cleanup
This commit is contained in:
parent
d74e2ed488
commit
954c0e6f67
180
update.sh
180
update.sh
@ -1,148 +1,150 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Install system packages
|
||||
sudo apt update && sudo apt -y upgrade && \
|
||||
sudo apt update && sudo apt -y upgrade &&
|
||||
sudo apt -y install ninja-build gettext cmake unzip curl python3 python3-pip python3-venv \
|
||||
build-essential libssl-dev libffi-dev python3-dev file tmux && \
|
||||
build-essential libssl-dev libffi-dev python3-dev file tmux &&
|
||||
|
||||
# Install VirtualHere client
|
||||
cd ~ && \
|
||||
wget https://www.virtualhere.com/sites/default/files/usbclient/scripts/virtualhereclient.service
|
||||
wget https://www.virtualhere.com/sites/default/files/usbclient/vhclientx86_64
|
||||
chmod +x ./vhclientx86_64
|
||||
sudo mv ./vhclientx86_64 /usr/sbin
|
||||
sudo mv virtualhereclient.service /etc/systemd/system/virtualhereclient.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable virtualhereclient.service
|
||||
sudo systemctl start virtualhereclient.service
|
||||
cd ~ &&
|
||||
wget https://www.virtualhere.com/sites/default/files/usbclient/scripts/virtualhereclient.service &&
|
||||
wget https://www.virtualhere.com/sites/default/files/usbclient/vhclientx86_64 &&
|
||||
chmod +x ./vhclientx86_64 &&
|
||||
sudo mv ./vhclientx86_64 /usr/sbin &&
|
||||
sudo mv virtualhereclient.service /etc/systemd/system/virtualhereclient.service &&
|
||||
sudo systemctl daemon-reload &&
|
||||
sudo systemctl enable virtualhereclient.service &&
|
||||
sudo systemctl start virtualhereclient.service &&
|
||||
|
||||
# Install teensy udev rules
|
||||
sudo rm -f /tmp/00-teensy.rules /etc/udev/rules.d/00-teensy.rules /lib/udev/rules.d/00-teensy.rules && \
|
||||
wget -O /tmp/00-teensy.rules https://www.pjrc.com/teensy/00-teensy.rules && \
|
||||
sudo install -o root -g root -m 0664 /tmp/00-teensy.rules /lib/udev/rules.d/00-teensy.rules && \
|
||||
sudo udevadm control --reload-rules && \
|
||||
sudo udevadm trigger && \
|
||||
sudo rm -f /tmp/00-teensy.rules /etc/udev/rules.d/00-teensy.rules /lib/udev/rules.d/00-teensy.rules &&
|
||||
wget -O /tmp/00-teensy.rules https://www.pjrc.com/teensy/00-teensy.rules &&
|
||||
sudo install -o root -g root -m 0664 /tmp/00-teensy.rules /lib/udev/rules.d/00-teensy.rules &&
|
||||
sudo udevadm control --reload-rules &&
|
||||
sudo udevadm trigger &&
|
||||
|
||||
# Install neovim
|
||||
if [ -d ~/neovim ]; then rm -rf ~/neovim; fi && \
|
||||
cd ~ && \
|
||||
git clone https://github.com/neovim/neovim && \
|
||||
cd neovim && git checkout stable && \
|
||||
make CMAKE_BUILD_TYPE=RelWithDebInfo && \
|
||||
cd build && cpack -G DEB && sudo dpkg -i nvim-linux64.deb && \
|
||||
if [ -d ~/neovim ]; then rm -rf ~/neovim; fi && \
|
||||
# Install neovim
|
||||
if [ -d ~/neovim ]; then rm -rf ~/neovim; fi &&
|
||||
cd ~ &&
|
||||
git clone https://github.com/neovim/neovim &&
|
||||
cd neovim && git checkout stable &&
|
||||
make CMAKE_BUILD_TYPE=RelWithDebInfo &&
|
||||
cd build && cpack -G DEB && sudo dpkg -i nvim-linux64.deb &&
|
||||
if [ -d ~/neovim ]; then rm -rf ~/neovim; fi &&
|
||||
|
||||
# Install tree sitter cli
|
||||
cd ~ && \
|
||||
sudo apt install -y cargo && \
|
||||
cargo install tree-sitter-cli && \
|
||||
# Install tree sitter cli
|
||||
cd ~ &&
|
||||
sudo apt install -y cargo &&
|
||||
cargo install tree-sitter-cli &&
|
||||
|
||||
# Install ripgrep
|
||||
sudo apt install -y ripgrep && \
|
||||
# Install ripgrep
|
||||
sudo apt install -y ripgrep &&
|
||||
|
||||
# Install fd
|
||||
sudo apt install -y fd-find && \
|
||||
# Install fd
|
||||
sudo apt install -y fd-find &&
|
||||
|
||||
# Install lazygit
|
||||
cd ~ && \
|
||||
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') && \
|
||||
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz" && \
|
||||
tar xf lazygit.tar.gz lazygit && \
|
||||
sudo install lazygit /usr/local/bin && \
|
||||
rm ~/lazygit && rm ~/lazygit.tar.gz && \
|
||||
cd ~ &&
|
||||
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*') &&
|
||||
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz" &&
|
||||
tar xf lazygit.tar.gz lazygit &&
|
||||
sudo install lazygit /usr/local/bin &&
|
||||
rm ~/lazygit && rm ~/lazygit.tar.gz &&
|
||||
|
||||
# Install gdu
|
||||
sudo add-apt-repository -y ppa:daniel-milde/gdu && \
|
||||
sudo apt update && \
|
||||
sudo apt install -y gdu && \
|
||||
sudo add-apt-repository -y ppa:daniel-milde/gdu &&
|
||||
sudo apt update &&
|
||||
sudo apt install -y gdu &&
|
||||
|
||||
# Install ruby
|
||||
sudo apt install -y ruby ruby-dev && \
|
||||
sudo gem install neovim && \
|
||||
# Install ruby
|
||||
sudo apt install -y ruby ruby-dev &&
|
||||
sudo gem install neovim &&
|
||||
|
||||
# Install bottom
|
||||
cd ~ && \
|
||||
curl -LO https://github.com/ClementTsang/bottom/releases/download/0.9.1/bottom_0.9.1_amd64.deb && \
|
||||
sudo dpkg -i bottom_0.9.1_amd64.deb && \
|
||||
rm ~/bottom_0.9.1_amd64.deb && \
|
||||
cd ~ &&
|
||||
curl -LO https://github.com/ClementTsang/bottom/releases/download/0.9.1/bottom_0.9.1_amd64.deb &&
|
||||
sudo dpkg -i bottom_0.9.1_amd64.deb &&
|
||||
rm ~/bottom_0.9.1_amd64.deb &&
|
||||
|
||||
# Install go
|
||||
sudo apt install -y golang && \
|
||||
sudo apt install -y golang &&
|
||||
|
||||
# Install php
|
||||
sudo apt install -y php php-curl php-xml php-mbstring && \
|
||||
sudo apt install -y php php-curl php-xml php-mbstring &&
|
||||
|
||||
# Install luarocks
|
||||
sudo apt install -y luarocks && \
|
||||
sudo apt install -y luarocks &&
|
||||
|
||||
# Install composer
|
||||
sudo apt install -y composer && \
|
||||
sudo apt install -y composer &&
|
||||
|
||||
# Install java
|
||||
sudo apt install -y default-jdk && \
|
||||
sudo apt install -y default-jdk &&
|
||||
|
||||
# Install julia
|
||||
wget https://julialang-s3.julialang.org/bin/linux/x64/1.9/julia-1.9.0-linux-x86_64.tar.gz && \
|
||||
tar -xvzf julia-1.9.0-linux-x86_64.tar.gz && \
|
||||
sudo cp -r julia-1.9.0 /opt/ && \
|
||||
sudo ln -sf /opt/julia-1.9.0/bin/julia /usr/local/bin/julia && \
|
||||
rm julia-1.9.0-linux-x86_64.tar.gz* && \
|
||||
rm -rf julia-1.9.0 && \
|
||||
wget https://julialang-s3.julialang.org/bin/linux/x64/1.9/julia-1.9.0-linux-x86_64.tar.gz &&
|
||||
tar -xvzf julia-1.9.0-linux-x86_64.tar.gz &&
|
||||
sudo cp -r julia-1.9.0 /opt/ &&
|
||||
sudo ln -sf /opt/julia-1.9.0/bin/julia /usr/local/bin/julia &&
|
||||
rm julia-1.9.0-linux-x86_64.tar.gz* &&
|
||||
rm -rf julia-1.9.0 &&
|
||||
|
||||
# Install node
|
||||
cd ~ && \
|
||||
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash - && \
|
||||
sudo apt install -y nodejs && \
|
||||
cd ~ &&
|
||||
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash - &&
|
||||
sudo apt install -y nodejs &&
|
||||
|
||||
# Install astronvim
|
||||
if [ ! -d ~/.config/nvim ];
|
||||
then git clone --depth 1 https://github.com/AstroNvim/AstroNvim ~/.config/nvim;
|
||||
fi && \
|
||||
fi &&
|
||||
|
||||
# Install platformio
|
||||
pip3 install platformio && \
|
||||
pip3 install platformio &&
|
||||
|
||||
# Install pynvim
|
||||
pip3 install pynvim && \
|
||||
# Install pynvim
|
||||
pip3 install pynvim &&
|
||||
|
||||
# Install neovim for node
|
||||
sudo npm install -g neovim && \
|
||||
sudo npm install -g neovim &&
|
||||
|
||||
# Symlink git config
|
||||
ln -sf ~/code_server/gitconfig ~/.gitconfig && \
|
||||
ln -sf ~/code_server/gitconfig ~/.gitconfig &&
|
||||
|
||||
# Symlink tmux config
|
||||
ln -sf ~/code_server/tmux.conf ~/.tmux.conf && \
|
||||
ln -sf ~/code_server/tmux.conf ~/.tmux.conf &&
|
||||
|
||||
# Symlink clang-format config
|
||||
ln -sf ~/code_server/clang-format ~/.clang-format && \
|
||||
ln -sf ~/code_server/clang-format ~/.clang-format &&
|
||||
|
||||
# Symlink nvim user folder
|
||||
if [ -L ~/.config/nvim/lua/user ]; then rm ~/.config/nvim/lua/user; fi && \
|
||||
ln -s ~/code_server/config/nvim/lua/user ~/.config/nvim/lua/user && \
|
||||
if [ -L ~/.config/nvim/lua/user ]; then rm ~/.config/nvim/lua/user; fi &&
|
||||
ln -s ~/code_server/config/nvim/lua/user ~/.config/nvim/lua/user &&
|
||||
|
||||
# Symlink lazygit config
|
||||
ln -sf ~/code_server/config/lazygit/config.yml ~/.config/lazygit/config.yml && \
|
||||
# Symlink lazygit config
|
||||
ln -sf ~/code_server/config/lazygit/config.yml ~/.config/lazygit/config.yml &&
|
||||
|
||||
# Symlink luacheck config
|
||||
ln -sf ~/code_server/luacheckrc ~/.luacheckrc && \
|
||||
# Symlink luacheck config
|
||||
ln -sf ~/code_server/luacheckrc ~/.luacheckrc &&
|
||||
|
||||
# Restore default .bashrc
|
||||
sudo /bin/cp /etc/skel/.bashrc ~/.bashrc && \
|
||||
# Symlink update script
|
||||
ln -sf ~/code_server/update.sh ~/.local/bin/update &&
|
||||
|
||||
# Restore default .bashrc
|
||||
sudo /bin/cp /etc/skel/.bashrc ~/.bashrc &&
|
||||
|
||||
# Add path to bashrc
|
||||
echo 'PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH"' >> ~/.bashrc && \
|
||||
echo 'alias vi="nvim"' >> ~/.bashrc && \
|
||||
echo 'alias vim="nvim"' >> ~/.bashrc && \
|
||||
echo 'PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH"' >> ~/.bashrc &&
|
||||
echo 'alias vi="nvim"' >> ~/.bashrc &&
|
||||
echo 'alias vim="nvim"' >> ~/.bashrc &&
|
||||
|
||||
# Add tmux/nvim autostart to bashrc
|
||||
echo "# TMUX" >> ~/.bashrc && \
|
||||
echo "if [[ ! \$TERM =~ screen ]]; then" >> ~/.bashrc && \
|
||||
echo "if which tmux >/dev/null 2>&1; then" >> ~/.bashrc && \
|
||||
echo ' test -z "$TMUX" && (tmux attach || tmux new-session nvim)' >> ~/.bashrc && \
|
||||
echo "fi" >> ~/.bashrc && \
|
||||
echo "fi" >> ~/.bashrc && \
|
||||
echo "# TMUX" >> ~/.bashrc &&
|
||||
echo "if [[ ! \$TERM =~ screen ]]; then" >> ~/.bashrc &&
|
||||
echo "if which tmux >/dev/null 2>&1; then" >> ~/.bashrc &&
|
||||
echo ' test -z "$TMUX" && (tmux attach || tmux new-session nvim)' >> ~/.bashrc &&
|
||||
echo "fi" >> ~/.bashrc &&
|
||||
echo "fi" >> ~/.bashrc &&
|
||||
|
||||
echo "" && \
|
||||
echo "" &&
|
||||
echo "Update complete! Please restart your terminal."
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user