Code cleanup
This commit is contained in:
194
update_arch.sh
194
update_arch.sh
@@ -1,5 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
if ! pacman -Qs inetutils >/dev/null; then
|
||||
sudo pacman -Syy --noconfirm inetutils
|
||||
fi
|
||||
if ! pacman -Qs awk >/dev/null; then
|
||||
sudo pacman -Syy --noconfirm awk
|
||||
fi
|
||||
|
||||
HOSTNAME=$(hostname | awk '{ print toupper($0) }')
|
||||
|
||||
echo -e ' \e[H\e[2J
|
||||
\e[0;34m.
|
||||
@@ -12,48 +20,68 @@ echo -e ' \e[H\e[2J
|
||||
\e[1;34m/.^ ^.\ \e[0;37mTM
|
||||
|
||||
|
||||
\e[1;32mCMtec CMBOX install/Update script\e[0;37m
|
||||
\e[1;32mCMtec '$HOSTNAME' install/Update script\e[0;37m
|
||||
'
|
||||
|
||||
# Create backup/snapshot
|
||||
if pacman -Qs timeshift >/dev/null; then
|
||||
CONFIG_FILE="/etc/timeshift/timeshift.json"
|
||||
if [ -f "$CONFIG_FILE" ]; then
|
||||
BTRFS_MODE=$(jq '.btrfs_mode' "$CONFIG_FILE")
|
||||
if [ "$BTRFS_MODE" == '"true"' ]; then
|
||||
printf -- '\033[33m Creating backup/snapshot\n\033[37m'
|
||||
sudo timeshift --create --comments "Update script"
|
||||
fi
|
||||
fi
|
||||
CONFIG_FILE="/etc/timeshift/timeshift.json"
|
||||
if [ -f "$CONFIG_FILE" ]; then
|
||||
BTRFS_MODE=$(jq '.btrfs_mode' "$CONFIG_FILE")
|
||||
if [ "$BTRFS_MODE" == '"true"' ]; then
|
||||
printf -- '\033[33m Creating backup/snapshot\n\033[37m'
|
||||
sudo timeshift --create --comments "Update script"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Read currently operating kernel version
|
||||
KERNEL=$(uname -r)
|
||||
# Enable multilib (if applicable)
|
||||
if [ "$HOSTNAME" == "STEAMBOX" ]; then
|
||||
if ! grep -q "^\[multilib\]" /etc/pacman.conf; then
|
||||
printf -- '\033[33m Enabling multilib\n\033[37m'
|
||||
sudo tee -a /etc/pacman.conf >/dev/null <<EOT
|
||||
|
||||
[multilib]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
EOT
|
||||
fi
|
||||
fi
|
||||
|
||||
# Update all pacman packages
|
||||
printf -- '\033[33m Updating pacman packages\n\033[37m'
|
||||
sudo pacman -Suyy --noconfirm
|
||||
|
||||
# Install drivers (if applicable)
|
||||
if [ "$HOSTNAME" == "STEAMBOX" ]; then
|
||||
# Install nvidia drivers
|
||||
printf -- '\033[33m Installing NVIDIA drivers\n\033[37m'
|
||||
sudo pacman --noconfirm --needed -S base-devel linux-headers git
|
||||
sudo pacman --noconfirm --needed -S nvidia-open-dkms nvidia-utils lib32-nvidia-utils nvidia-settings opencl-nvidia
|
||||
|
||||
fi
|
||||
|
||||
# Update all AUR packages
|
||||
printf -- '\033[33m Updating AUR packages\n\033[37m'
|
||||
if pacman -Qs yay >/dev/null; then
|
||||
yay --noconfirm --aur
|
||||
yay --noconfirm --aur
|
||||
else
|
||||
sudo pacman -S --needed --noconfirm git base-devel
|
||||
if [ -d ~/yay-bin ]; then rm -rf ~/yay-bin; fi
|
||||
cd ~
|
||||
git clone https://aur.archlinux.org/yay-bin.git
|
||||
cd yay-bin
|
||||
makepkg --noconfirm -si
|
||||
cd ~
|
||||
if [ -d ~/yay-bin ]; then rm -rf ~/yay-bin; fi
|
||||
sudo pacman -S --needed --noconfirm git base-devel
|
||||
if [ -d ~/yay-bin ]; then rm -rf ~/yay-bin; fi
|
||||
cd ~
|
||||
git clone https://aur.archlinux.org/yay-bin.git
|
||||
cd yay-bin
|
||||
makepkg --noconfirm -si
|
||||
cd ~
|
||||
if [ -d ~/yay-bin ]; then rm -rf ~/yay-bin; fi
|
||||
fi
|
||||
# Update all Flatpak packages
|
||||
printf -- '\033[33m Updating Flatpak packages\n\033[37m'
|
||||
if pacman -Qs flatpak >/dev/null; then
|
||||
flatpak update -y
|
||||
flatpak update -y
|
||||
else
|
||||
sudo pacman --noconfirm --needed -S flatpak
|
||||
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
flatpak install -y flathub com.github.tchx84.Flatseal
|
||||
sudo pacman --noconfirm --needed -S flatpak
|
||||
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
flatpak install -y flathub com.github.tchx84.Flatseal
|
||||
fi
|
||||
|
||||
# Install initial system packages
|
||||
@@ -76,7 +104,7 @@ sudo pacman --noconfirm --needed -S usbutils plymouth dracut dunst hypridle hypr
|
||||
yay --noconfirm -S --needed --aur adwaita-qt5-git
|
||||
yay --noconfirm -S --needed --aur adwaita-qt6-git
|
||||
yay --noconfirm -S --needed --aur wlogout
|
||||
yay --noconfirm -S --needed --aur hyprshot
|
||||
yay --noconfirm -S --needed --aur hyprshot
|
||||
|
||||
mkdir -p ~/.local/bin
|
||||
mkdir -p ~/.config/hypr
|
||||
@@ -85,8 +113,13 @@ mkdir -p ~/.config/qt5ct
|
||||
mkdir -p ~/.config/qt6ct
|
||||
mkdir -p ~/.config/dunst
|
||||
|
||||
if [ !"$HOSTNAME" == "" ]; then
|
||||
ln -sf ~/code_server/config/hypr/hyprland_$HOSTNAME.conf ~/.config/hypr/hyprland.conf
|
||||
else
|
||||
ln -sf ~/code_server/config/hypr/hyprland_CMBOX.conf ~/.config/hypr/hyprland.conf
|
||||
fi
|
||||
|
||||
ln -sf ~/code_server/wrappedhl ~/.local/bin/wrappedhl
|
||||
ln -sf ~/code_server/config/hypr/hyprland.conf ~/.config/hypr/hyprland.conf
|
||||
ln -sf ~/code_server/config/hypr/hypridle.conf ~/.config/hypr/hypridle.conf
|
||||
ln -sf ~/code_server/config/gtk-3.0/settings.ini ~/.config/gtk-3.0/settings.ini
|
||||
ln -sf ~/code_server/config/qt5ct/qt5ct.conf ~/.config/qt5ct/qt5ct.conf
|
||||
@@ -102,15 +135,10 @@ ln -sf ~/code_server/config/waybar/style.css ~/.config/waybar/style.css
|
||||
|
||||
# Install Audio
|
||||
printf -- '\033[33m Installing Audio\n\033[37m'
|
||||
sudo pacman --noconfirm --needed -S pipewire pipewire-pulse pavucontrol helvum
|
||||
sudo pacman --noconfirm --needed -S pipewire pipewire-pulse pipewire-alsa pavucontrol helvum
|
||||
mkdir -p ~/.config/pipewire
|
||||
ln -sf ~/code_server/config/pipewire/pipewire.conf ~/.config/pipewire/pipewire.conf
|
||||
|
||||
# #Install input-remapper
|
||||
# printf -- '\033[33m Installing input-remapper\n\033[37m'
|
||||
# yay --noconfirm -S --needed --aur input-remapper-git
|
||||
# sudo systemctl enable --now input-remapper
|
||||
|
||||
# Install networkmanager
|
||||
printf -- '\033[33m Installing networkmanager\n\033[37m'
|
||||
sudo pacman --noconfirm --needed -S network-manager-applet
|
||||
@@ -160,8 +188,8 @@ printf -- '\033[33m Installing fzfmenu\n\033[37m'
|
||||
mkdir -p ~/.local/bin
|
||||
ln -sf ~/code_server/fzfmenu.sh ~/.local/bin/fzfmenu
|
||||
|
||||
# Install VirtualHere server
|
||||
curl https://raw.githubusercontent.com/virtualhere/script/main/install_server | sudo sh
|
||||
# # Install VirtualHere server
|
||||
# curl https://raw.githubusercontent.com/virtualhere/script/main/install_server | sudo sh
|
||||
|
||||
# Install VirtualHere client
|
||||
printf -- '\033[33m Installing VirtualHere client\n\033[37m'
|
||||
@@ -176,18 +204,18 @@ sudo mv ./vhuit64 /usr/sbin
|
||||
echo "$USER ALL=(ALL:ALL) NOPASSWD: /usr/sbin/vhclientx86_64" | sudo tee /etc/sudoers.d/$USER+vhclientx86_64
|
||||
echo "$USER ALL=(ALL:ALL) NOPASSWD: /usr/sbin/vhuit64" | sudo tee /etc/sudoers.d/$USER+vhuit64
|
||||
sudo mv virtualhereclient.service /etc/systemd/system/virtualhereclient.service
|
||||
# sudo systemctl daemon-reload
|
||||
# sudo systemctl enable virtualhereclient.service
|
||||
# sudo systemctl start virtualhereclient.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable virtualhereclient.service
|
||||
sudo systemctl start virtualhereclient.service
|
||||
|
||||
# Install teensy udev rules (only for non docker system)
|
||||
if [ ! -f /.dockerenv ]; then
|
||||
printf -- '\033[33m Installing teensy udev rules\n\033[37m'
|
||||
sudo rm -f /tmp/00-teensy.rules /etc/udev/rules.d/00-teensy.rules /lib/udev/rules.d/00-teensy.rules
|
||||
sudo 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
|
||||
printf -- '\033[33m Installing teensy udev rules\n\033[37m'
|
||||
sudo rm -f /tmp/00-teensy.rules /etc/udev/rules.d/00-teensy.rules /lib/udev/rules.d/00-teensy.rules
|
||||
sudo 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
|
||||
fi
|
||||
|
||||
# Install neovim
|
||||
@@ -317,40 +345,58 @@ printf -- '\033[33m Installing XAir\n\033[37m'
|
||||
flatpak install -y flathub com.behringer.XAirEdit
|
||||
|
||||
# Install Krita
|
||||
printf -- '\033[33m Installing Krita\n\033[37m'
|
||||
flatpak install -y flathub org.kde.krita
|
||||
if [ "$HOSTNAME" == "CMBOX" ]; then
|
||||
printf -- '\033[33m Installing Krita\n\033[37m'
|
||||
flatpak install -y flathub org.kde.krita
|
||||
fi
|
||||
|
||||
# Install KiCad
|
||||
printf -- '\033[33m Installing KiCad\n\033[37m'
|
||||
sudo pacman --noconfirm --needed -S kicad
|
||||
if [ "$HOSTNAME" == "CMBOX" ]; then
|
||||
printf -- '\033[33m Installing KiCad\n\033[37m'
|
||||
sudo pacman --noconfirm --needed -S kicad
|
||||
fi
|
||||
|
||||
# Install FreeCad
|
||||
printf -- '\033[33m Installing FreeCad\n\033[37m'
|
||||
sudo pacman --noconfirm --needed -S freecad
|
||||
if [ "$HOSTNAME" == "CMBOX" ]; then
|
||||
printf -- '\033[33m Installing FreeCad\n\033[37m'
|
||||
sudo pacman --noconfirm --needed -S freecad
|
||||
fi
|
||||
|
||||
# Install Prusaslicer
|
||||
printf -- '\033[33m Installing Prusaslicer\n\033[37m'
|
||||
flatpak install -y flathub com.prusa3d.PrusaSlicer
|
||||
if [ "$HOSTNAME" == "CMBOX" ]; then
|
||||
printf -- '\033[33m Installing Prusaslicer\n\033[37m'
|
||||
flatpak install -y flathub com.prusa3d.PrusaSlicer
|
||||
fi
|
||||
|
||||
# Install Moonlight
|
||||
printf -- '\033[33m Installing Moonlight\n\033[37m'
|
||||
flatpak install -y flathub com.moonlight_stream.Moonlight
|
||||
if [ "$HOSTNAME" == "CMBOX" ]; then
|
||||
printf -- '\033[33m Installing Moonlight\n\033[37m'
|
||||
flatpak install -y flathub com.moonlight_stream.Moonlight
|
||||
fi
|
||||
|
||||
# Install DrawIo
|
||||
printf -- '\033[33m Installing DrawIo\n\033[37m'
|
||||
flatpak install -y flathub com.jgraph.drawio.desktop
|
||||
if [ "$HOSTNAME" == "CMBOX" ]; then
|
||||
printf -- '\033[33m Installing DrawIo\n\033[37m'
|
||||
flatpak install -y flathub com.jgraph.drawio.desktop
|
||||
fi
|
||||
|
||||
# Install Gimp
|
||||
printf -- '\033[33m Installing Gimp\n\033[37m'
|
||||
flatpak install -y flathub org.gimp.GIMP
|
||||
if [ "$HOSTNAME" == "CMBOX" ]; then
|
||||
printf -- '\033[33m Installing Gimp\n\033[37m'
|
||||
flatpak install -y flathub org.gimp.GIMP
|
||||
fi
|
||||
|
||||
# Install VSCode
|
||||
printf -- '\033[33m Installing VSCode\n\033[37m'
|
||||
sudo pacman --noconfirm --needed -S code
|
||||
if [ "$HOSTNAME" == "CMBOX" ]; then
|
||||
printf -- '\033[33m Installing VSCode\n\033[37m'
|
||||
sudo pacman --noconfirm --needed -S code
|
||||
fi
|
||||
|
||||
# Install remmina
|
||||
printf -- '\033[33m Installing remmina\n\033[37m'
|
||||
flatpak install -y flathub org.remmina.Remmina
|
||||
if [ "$HOSTNAME" == "CMBOX" ]; then
|
||||
printf -- '\033[33m Installing remmina\n\033[37m'
|
||||
flatpak install -y flathub org.remmina.Remmina
|
||||
fi
|
||||
|
||||
# Install feh
|
||||
printf -- '\033[33m Installing feh\n\033[37m'
|
||||
@@ -376,12 +422,6 @@ sudo pacman --noconfirm --needed -S noto-fonts poppler-data adobe-source-code-pr
|
||||
printf -- '\033[33m Installing Brave Browser\n\033[37m'
|
||||
yay --noconfirm -S --needed --aur brave-bin
|
||||
|
||||
# # Install Virtualbox
|
||||
# printf -- '\033[33m Installing Virtualbox\n\033[37m'
|
||||
# sudo pacman --noconfirm --needed -S virtualbox virtualbox-guest-iso
|
||||
# yay --noconfirm -S --needed --aur virtualbox-ext-oracle
|
||||
# sudo usermod -a -G vboxusers "$USER"
|
||||
|
||||
# Install timeshift
|
||||
printf -- '\033[33m Installing Timeshift\n\033[37m'
|
||||
sudo pacman --noconfirm --needed -S timeshift
|
||||
@@ -393,14 +433,22 @@ yay --noconfirm --needed -S sunshine
|
||||
echo 'KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"' | sudo tee /etc/udev/rules.d/60-sunshine.rules
|
||||
mkdir -p ~/.config/systemd/user
|
||||
cp -f ~/code_server/config/systemd/user/sunshine.service ~/.config/systemd/user/sunshine.service
|
||||
# if [ "$KERNEL" == "$(uname -r)" ]; then
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger
|
||||
# sudo modprobe uinput
|
||||
sudo setcap cap_sys_admin+p $(readlink -f $(which sunshine))
|
||||
sudo systemctl daemon-reload
|
||||
systemctl --user start sunshine
|
||||
# fi
|
||||
|
||||
# Install game services
|
||||
if [ "$HOSTNAME" == "STEAMBOX" ]; then
|
||||
printf -- '\033[33m Installing Game services\n\033[37m'
|
||||
# sudo systemctl enable fstrim.timer
|
||||
sudo pacman -S --noconfirm --needed steam lutris wine-staging winetricks gamemode lib32-gamemode giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls mpg123 lib32-mpg123 openal lib32-openal \
|
||||
v4l-utils lib32-v4l-utils libgpg-error lib32-libgpg-error alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo sqlite lib32-sqlite libxcomposite lib32-libxcomposite libxinerama \
|
||||
lib32-libxinerama ncurses lib32-ncurses opencl-icd-loader lib32-opencl-icd-loader libxslt lib32-libxslt libva lib32-libva gtk3 lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs vulkan-icd-loader \
|
||||
lib32-vulkan-icd-loader mangohud lib32-mangohud goverlay gamescope solaar lib32-libpulse
|
||||
yay --noconfirm -S --needed --aur vkbasalt lib32-vkbasalt proton-ge-custom-bin xone-dkms-git dxvk-bin vkd3d-proton-bin
|
||||
fi
|
||||
|
||||
# Symlink update script
|
||||
printf -- '\033[33m Symlinking update wrapper\n\033[37m'
|
||||
@@ -411,8 +459,4 @@ ln -sf ~/code_server/update_wrapper.sh ~/.local/bin/update
|
||||
printf -- '\033[33m Symlinking bashrc config\n\033[37m'
|
||||
ln -sf ~/code_server/bashrc ~/.bashrc
|
||||
|
||||
if [ "$KERNEL" == "$(uname -r)" ]; then
|
||||
printf -- '\033[32m \n\n***** Update complete! *****\n\n\033[37m'
|
||||
else
|
||||
printf -- '\033[32m \n\n***** Update complete! KERNEL UPDATE !!! Please reboot. *****\n\n\033[37m'
|
||||
fi
|
||||
printf -- '\033[32m \n\n***** Update complete! Please reboot. *****\n\n\033[37m'
|
||||
|
||||
Reference in New Issue
Block a user