This commit is contained in:
Christoffer Martinsson 2024-11-23 12:36:32 +01:00
parent b28158a9c2
commit 76e6f5e862

367
update.sh
View File

@ -24,7 +24,14 @@ if [ "$OS" == "Ubuntu" ]; then
else
WSL="no"
fi
elif [ "$OS" == "Arch Linux" ]; then
DESKTOP="yes"
WSL="no"
fi
# *** System applications ***
printf -- '\033[32m *** System applications ***\n\033[37m'
# Ubuntu 20.04 workaround
if [ "$OS" == "Ubuntu" ]; then
sudo apt -y purge --auto-remove neovim
@ -35,8 +42,7 @@ printf -- '\033[33m Installing system packages\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
sudo apt update
sudo apt upgrade -y
sudo apt install -y imagemagick gpg ninja-build gettext cmake unzip curl python3 python3-pip python3-venv \
build-essential libssl-dev libffi-dev python3-dev file tmux libudev-dev pkg-config locales pipx btop ncdu ranger
sudo apt install -y gawk imagemagick gpg ninja-build gettext cmake unzip curl build-essential libssl-dev libffi-dev file tmux libudev-dev pkg-config locales btop ncdu ranger
elif [ "$OS" == "Arch Linux" ]; then
sudo pacman -Suyy --noconfirm
if pacman -Qs yay >/dev/null; then
@ -51,12 +57,13 @@ elif [ "$OS" == "Arch Linux" ]; then
cd ~
if [ -d ~/yay-bin ]; then rm -rf ~/yay-bin; fi
fi
sudo pacman --noconfirm --needed -S hyprland gnome-keyring pipewire git base-devel cmake gawk wget gettext unzip curl python python-pip python-pipx python-pipenv python-pynvim tmux btop ncdu ranger qt5ct qt6ct gnome-themes-extra
sudo pacman --noconfirm --needed -S gdm waybar hyprland gnome-keyring pipewire git base-devel cmake gawk wget gettext unzip curl tmux btop ncdu ranger qt5ct qt6ct gnome-themes-extra
yay --noconfirm -S --needed --aur archlinux-tweak-tool-git
yay --noconfirm -S --needed --aur adwaita-qt5-git
yay --noconfirm -S --needed --aur adwaita-qt6-git
fi
# Setup locals
printf -- '\033[33m Setup locals\n\033[37m'
sudo locale-gen "en_US.UTF-8"
@ -66,6 +73,19 @@ elif [ "$OS" == "Arch Linux" ]; then
sudo localectl set-locale LANG=en_US.UTF-8
fi
# Install python
printf -- '\033[33m Installing python\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
sudo apt install -y python3 python3-pip python3-venv python3-dev pipx
if [ "$VER" == "22.04" ]; then
pip3 install pynvim
else
sudo apt install -y python3-pynvim
fi
elif [ "$OS" == "Arch Linux" ]; then
sudo pacman --noconfirm --needed -S python python-pip python-pipx python-pipenv python-pynvim
fi
# Install fzf
printf -- '\033[33m Installing fzf\n\033[37m'
rm -rf ~/.fzf
@ -207,12 +227,16 @@ fi
# Install julia
printf -- '\033[33m Installing julia\n\033[37m'
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
if [ "$OS" == "Ubuntu" ]; then
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
elif [ "$OS" == "Arch Linux" ]; then
sudo pacman --noconfirm --needed -S julia
fi
# Install node
printf -- '\033[33m Installing node\n\033[37m'
@ -227,15 +251,11 @@ fi
# Install ble.sh
printf -- '\033[33m Installing ble.sh\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
sudo apt install gawk
elif [ "$OS" == "Arch Linux" ]; then
sudo pacman --noconfirm --needed -S gawk
fi
if [ -d ~/ble.sh ]; then rm -rf ~/ble.sh; fi
cd ~
git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git
make -C ble.sh install PREFIX=~/.local
#make -C ble.sh install PREFIX=~/.local
make -C ble.sh install
if [ -d ~/ble.sh ]; then rm -rf ~/ble.sh; fi
# Install platformio
@ -251,152 +271,10 @@ elif [ "$OS" == "Arch Linux" ]; then
sudo pacman --noconfirm --needed -S platformio-core
fi
# Install pynvim
printf -- '\033[33m Installing pynvim\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
if [ "$VER" == "24.04" ]; then
sudo apt install -y python3-pynvim
else
pip3 install pynvim
fi
fi
# Install neovim for node
printf -- '\033[33m Installing neovim for node\n\033[37m'
sudo npm install -g neovim
if [ "$DESKTOP" == "yes" ] || [ "$OS" == "Arch Linux" ]; then
# Install flatpak
printf -- '\033[33m Installing desktop dep.\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
sudo add-apt-repository -y ppa:flatpak/stable
sudo apt update
sudo apt install -y flatpak
elif [ "$OS" == "Arch Linux" ]; then
sudo pacman --noconfirm --needed -S flatpak
fi
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
printf -- '\033[33m Installing Flatseal\n\033[37m'
flatpak install -y flathub com.github.tchx84.Flatseal
printf -- '\033[33m Installing Krita\n\033[37m'
flatpak install -y flathub org.kde.krita
printf -- '\033[33m Installing KiCad\n\033[37m'
flatpak install -y flathub org.kicad.KiCad
printf -- '\033[33m Installing FreeCad\n\033[37m'
flatpak install -y flathub org.freecadweb.FreeCAD
printf -- '\033[33m Installing Moonlight\n\033[37m'
flatpak install -y flathub com.moonlight_stream.Moonlight
printf -- '\033[33m Installing DrawIo\n\033[37m'
flatpak install -y flathub com.jgraph.drawio.desktop
# Install VSCode
if [ "$OS" == "Ubuntu" ]; then
printf -- '\033[33m Installing VSCode\n\033[37m'
sudo snap install --classic code
fi
# Install gnome-shell-extension-manager
if [ "$OS" == "Ubuntu" ]; then
printf -- '\033[33m Installing gnome-shell-extension-manager\n\033[37m'
sudo apt install -y gnome-shell-extension-manager
fi
# Install remmina
printf -- '\033[33m Installing remmina\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
sudo apt install -y remmina
elif [ "$OS" == "Arch Linux" ]; then
sudo pacman --noconfirm --needed -S remmina
fi
# Install gnome tweaks
if [ "$OS" == "Ubuntu" ]; then
printf -- '\033[33m Installing gnome tweaks\n\033[37m'
sudo apt install -y gnome-tweaks
fi
# Install feh
printf -- '\033[33m Installing feh\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
sudo apt install -y feh
elif [ "$OS" == "Arch Linux" ]; then
sudo pacman --noconfirm --needed -S feh
fi
# Install NerdFonts
printf -- '\033[33m Installing NerdFonts\n\033[37m'
mkdir -p /home/$USER/.local/share/fonts
cd /home/$USER/.local/share/fonts
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/CodeNewRoman.zip
unzip -o CodeNewRoman.zip
rm CodeNewRoman.zip
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/NerdFontsSymbolsOnly.zip
unzip -o NerdFontsSymbolsOnly.zip
rm NerdFontsSymbolsOnly.zip
fc-cache -fv
# Install Wezterm
if [ "$OS" == "Ubuntu" ]; then
printf -- '\033[33m Installing wezterm\n\033[37m'
curl -fsSL https://apt.fury.io/wez/gpg.key | sudo gpg --yes --dearmor -o /usr/share/keyrings/wezterm-fury.gpg
echo 'deb [signed-by=/usr/share/keyrings/wezterm-fury.gpg] https://apt.fury.io/wez/ * *' | sudo tee /etc/apt/sources.list.d/wezterm.list
sudo apt update
sudo apt install -y wezterm
# Symlink wezterm config
printf -- '\033[33m Symlinking wezterm config\n\033[37m'
ln -sf ~/code_server/wezterm.lua ~/.wezterm.lua
fi
# Install Brave Browser
printf -- '\033[33m Installing Brave Browser\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list
sudo apt update
sudo apt install -y brave-browser
elif [ "$OS" == "Arch Linux" ]; then
yay --noconfirm -S --needed --aur brave-bin
fi
# Install Virtualbox
printf -- '\033[33m Installing Virtualbox\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
curl https://www.virtualbox.org/download/oracle_vbox_2016.asc | gpg --dearmor >oracle_vbox_2016.gpg
curl https://www.virtualbox.org/download/oracle_vbox.asc | gpg --dearmor >oracle_vbox.gpg
sudo install -o root -g root -m 644 oracle_vbox_2016.gpg /etc/apt/trusted.gpg.d/
sudo install -o root -g root -m 644 oracle_vbox.gpg /etc/apt/trusted.gpg.d/
echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
sudo apt update
sudo apt install -y linux-headers-"$(uname -r)" dkms
sudo apt install virtualbox-7.1 -y
wget https://download.virtualbox.org/virtualbox/7.1.4/Oracle_VirtualBox_Extension_Pack-7.1.4.vbox-extpack
sudo VBoxManage extpack install --replace Oracle_VirtualBox_Extension_Pack-7.1.4.vbox-extpack --accept-license=eb31505e56e9b4d0fbca139104da41ac6f6b98f8e78968bdf01b1f3da3c4f9ae
elif [ "$OS" == "Arch Linux" ]; then
sudo pacman --noconfirm --needed -S virtualbox virtualbox-guest-iso
yay --noconfirm -S --needed --aur virtualbox-ext-oracle
fi
sudo usermod -a -G vboxusers "$USER"
if [ $VER == "22.04" ]; then
# Install helvum
printf -- '\033[33m Installing pavucontrol\n\033[37m'
sudo apt install -y pavucontrol
fi
if [ $VER == "24.04" ]; then
# Install helvum
printf -- '\033[33m Installing helvum\n\033[37m'
sudo apt install -y helvum
fi
fi
# Install rust
printf -- '\033[33m Installing Rust\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
@ -438,15 +316,172 @@ cargo install zoxide --locked
printf -- '\033[33m Installing starship\n\033[37m'
cargo install starship --locked
# *** Desktop applications ***
printf -- '\033[32m *** Desktop applications ***\n\033[37m'
if [ "$DESKTOP" == "yes" ]; then
# Install flatpak
printf -- '\033[33m Installing desktop dep.\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
sudo add-apt-repository -y ppa:flatpak/stable
sudo apt update
sudo apt install -y flatpak
elif [ "$OS" == "Arch Linux" ]; then
sudo pacman --noconfirm --needed -S flatpak
fi
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
printf -- '\033[33m Installing Flatseal\n\033[37m'
flatpak install -y flathub com.github.tchx84.Flatseal
printf -- '\033[33m Installing Krita\n\033[37m'
flatpak install -y flathub org.kde.krita
printf -- '\033[33m Installing KiCad\n\033[37m'
flatpak install -y flathub org.kicad.KiCad
printf -- '\033[33m Installing FreeCad\n\033[37m'
flatpak install -y flathub org.freecadweb.FreeCAD
printf -- '\033[33m Installing Moonlight\n\033[37m'
flatpak install -y flathub com.moonlight_stream.Moonlight
printf -- '\033[33m Installing DrawIo\n\033[37m'
flatpak install -y flathub com.jgraph.drawio.desktop
# Install VSCode
printf -- '\033[33m Installing VSCode\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
sudo snap install --classic code
elif [ "$OS" == "Arch Linux" ]; then
sudo pacman --noconfirm --needed -S code
fi
# Install gnome-shell-extension-manager
if [ "$OS" == "Ubuntu" ]; then
printf -- '\033[33m Installing gnome-shell-extension-manager\n\033[37m'
sudo apt install -y gnome-shell-extension-manager
fi
# Install gnome tweaks
if [ "$OS" == "Ubuntu" ]; then
printf -- '\033[33m Installing gnome tweaks\n\033[37m'
sudo apt install -y gnome-tweaks
fi
# Install remmina
printf -- '\033[33m Installing remmina\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
sudo apt install -y remmina
elif [ "$OS" == "Arch Linux" ]; then
sudo pacman --noconfirm --needed -S remmina
fi
# Install feh
printf -- '\033[33m Installing feh\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
sudo apt install -y feh
elif [ "$OS" == "Arch Linux" ]; then
sudo pacman --noconfirm --needed -S feh
fi
# Install NerdFonts
printf -- '\033[33m Installing NerdFonts\n\033[37m'
mkdir -p /home/$USER/.local/share/fonts
cd /home/$USER/.local/share/fonts
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/CodeNewRoman.zip
unzip -o CodeNewRoman.zip
rm CodeNewRoman.zip
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/NerdFontsSymbolsOnly.zip
unzip -o NerdFontsSymbolsOnly.zip
rm NerdFontsSymbolsOnly.zip
fc-cache -fv
# Install Wezterm
if [ "$OS" == "Ubuntu" ]; then
printf -- '\033[33m Installing wezterm\n\033[37m'
curl -fsSL https://apt.fury.io/wez/gpg.key | sudo gpg --yes --dearmor -o /usr/share/keyrings/wezterm-fury.gpg
echo 'deb [signed-by=/usr/share/keyrings/wezterm-fury.gpg] https://apt.fury.io/wez/ * *' | sudo tee /etc/apt/sources.list.d/wezterm.list
sudo apt update
sudo apt install -y wezterm
fi
# Install Brave Browser
printf -- '\033[33m Installing Brave Browser\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list
sudo apt update
sudo apt install -y brave-browser
elif [ "$OS" == "Arch Linux" ]; then
yay --noconfirm -S --needed --aur brave-bin
fi
# Install Virtualbox
printf -- '\033[33m Installing Virtualbox\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
curl https://www.virtualbox.org/download/oracle_vbox_2016.asc | gpg --dearmor >oracle_vbox_2016.gpg
curl https://www.virtualbox.org/download/oracle_vbox.asc | gpg --dearmor >oracle_vbox.gpg
sudo install -o root -g root -m 644 oracle_vbox_2016.gpg /etc/apt/trusted.gpg.d/
sudo install -o root -g root -m 644 oracle_vbox.gpg /etc/apt/trusted.gpg.d/
echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
sudo apt update
sudo apt install -y linux-headers-"$(uname -r)" dkms
sudo apt install virtualbox-7.1 -y
wget https://download.virtualbox.org/virtualbox/7.1.4/Oracle_VirtualBox_Extension_Pack-7.1.4.vbox-extpack
sudo VBoxManage extpack install --replace Oracle_VirtualBox_Extension_Pack-7.1.4.vbox-extpack --accept-license=eb31505e56e9b4d0fbca139104da41ac6f6b98f8e78968bdf01b1f3da3c4f9ae
elif [ "$OS" == "Arch Linux" ]; then
sudo pacman --noconfirm --needed -S virtualbox virtualbox-guest-iso
yay --noconfirm -S --needed --aur virtualbox-ext-oracle
fi
sudo usermod -a -G vboxusers "$USER"
printf -- '\033[33m Installing Audio control\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
if [ $VER == "22.04" ]; then
# Install helvum
sudo apt install -y pavucontrol
fi
if [ $VER == "24.04" ]; then
# Install helvum
sudo apt install -y pavucontrol helvum
fi
elif [ "$OS" == "Arch Linux" ]; then
sudo pacman --noconfirm --needed -S pavucontrol helvum
fi
# Install timeshift
printf -- '\033[33m timeshift fd\n\033[37m'
if [ "$OS" == "Ubuntu" ]; then
sudo apt install -y timeshift
elif [ "$OS" == "Arch Linux" ]; then
sudo pacman --noconfirm --needed -S timeshift
fi
fi
# *** Dotfile symlinking ***
printf -- '\033[32m *** Dotfile symlinking ***\n\033[37m'
# Symlink hyperland config
printf -- '\033[33m Symlinking hyperland config\n\033[37m'
mkdir -p ~/.config/hypr
ln -sf ~/code_server/config/hypr/hyprland.conf ~/.config/hypr/hyprland.conf
if [ "$OS" == "Arch Linux" ]; then
printf -- '\033[33m Symlinking hyperland config\n\033[37m'
mkdir -p ~/.config/hypr
ln -sf ~/code_server/config/hypr/hyprland.conf ~/.config/hypr/hyprland.conf
fi
# Symlink kitty config
printf -- '\033[33m Symlinking kitty config\n\033[37m'
mkdir -p ~/.config/kitty
ln -sf ~/code_server/config/kitty/kitty.conf ~/.config/kitty/kitty.conf
if [ "$OS" == "Arch Linux" ]; then
printf -- '\033[33m Symlinking kitty config\n\033[37m'
mkdir -p ~/.config/kitty
ln -sf ~/code_server/config/kitty/kitty.conf ~/.config/kitty/kitty.conf
fi
# Symlink wezterm config
if [ "$OS" == "Ubuntu" ]; then
printf -- '\033[33m Symlinking wezterm config\n\033[37m'
ln -sf ~/code_server/wezterm.lua ~/.wezterm.lua
fi
# Symlink nvim config
printf -- '\033[33m Symlinking nvim config\n\033[37m'
@ -484,16 +519,16 @@ mkdir -p ~/.local/bin
ln -sf ~/code_server/pico-load.sh ~/.local/bin/pico-load
# Symlink blerc
printf -- '\033[33m Symlinking blerc\n\033[37m'
printf -- '\033[33m Symlinking blerc config\n\033[37m'
ln -sf ~/code_server/blerc ~/.blerc
# Symlink update script
printf -- '\033[33m Symlinking update script\n\033[37m'
printf -- '\033[33m Symlinking update wrapper\n\033[37m'
mkdir -p ~/.local/bin
ln -sf ~/code_server/update_wrapper.sh ~/.local/bin/update
# Symlink bashrc
printf -- '\033[33m Symlinking bashrc\n\033[37m'
printf -- '\033[33m Symlinking bashrc config\n\033[37m'
ln -sf ~/code_server/bashrc ~/.bashrc
printf -- '\033[32m \n\n***** Update complete! Please restart your terminal. *****\n\n\033[37m'