DotHub/opensuse/setup.sh

338 lines
11 KiB
Bash
Raw Normal View History

2025-01-09 00:43:45 +01:00
#!/bin/bash
# A Bash script for installing all my openSUSE tools
2025-01-09 00:43:45 +01:00
clear
2025-01-09 03:12:12 +01:00
echo "This script will reconfigure your openSUSE Tumblweed install and add multiple applications and dependencies."
2025-01-09 00:43:45 +01:00
echo "You probably don't want this unless you're me!"
echo
echo "Press Ctrl-C to cancel or Enter to continue."
read
sudo echo "Starting setup..."
2025-01-09 02:11:08 +01:00
# Make sure some folders exist
mkdir -p "$HOME/Downloads"
mkdir -p "$XDG_CONFIG_HOME/autostart"
2025-01-09 00:43:45 +01:00
# Set hostname
echo
echo "Setting hostname..."
echo -n "Enter your desired hostname and press [ENTER]: "
read PICKED_HOSTNAME
2025-01-09 02:32:10 +01:00
# Did they pick one?
if [ -z "$PICKED_HOSTNAME" ]; then
echo "No hostname entered, skipping..."
else
# Set the hostname
sudo hostnamectl set-hostname $PICKED_HOSTNAME
echo "Your hostname is now \"$(hostname)\""
fi
2025-01-09 00:43:45 +01:00
# Git
2025-01-09 03:12:12 +01:00
echo
echo "Installing Git..."
2025-01-09 00:43:45 +01:00
sudo zypper --non-interactive install git
# Git Settings
echo -n "Enter your GIT name: "; read GIT_NAME
echo -n "Enter your GIT email: "; read GIT_EMAIL
git config --global user.name "$GIT_NAME"
git config --global user.email "$GIT_EMAIL"
2025-01-09 03:51:07 +01:00
# Adding pacman repo
echo
echo "Adding pacman repo..."
sudo zypper --non-interactive --gpg-auto-import-keys addrepo -cfp 90 'https://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Tumbleweed/' packman
2025-01-09 03:51:07 +01:00
2025-01-09 00:43:45 +01:00
# Make sure we're up to date
echo
echo "Updating system..."
2025-01-09 03:20:22 +01:00
sudo zypper --non-interactive --gpg-auto-import-keys update
sudo zypper --non-interactive --gpg-auto-import-keys dup
2025-01-09 00:43:45 +01:00
# NVIDIA Drivers
echo
2025-02-03 13:58:15 +00:00
echo "Installing NVIDIA drivers..."
2025-01-09 03:20:22 +01:00
sudo zypper --non-interactive --gpg-auto-import-keys install -l openSUSE-repos-Tumbleweed-NVIDIA
2025-01-09 03:22:04 +01:00
sudo zypper --non-interactive --gpg-auto-import-keys install-new-recommends --repo repo-non-free
2025-01-09 00:43:45 +01:00
# NVIDIA Settings
echo
echo "Installing NVIDIA settings..."
sudo zypper --non-interactive install nvidia-utils*
# Media Codecs
# Nothing to do
# Language, Time & Date
# Sets system to English, currency, dates etc. to Swedish
echo
echo "Setting system language to English and region to Sweden..."
2025-01-09 02:32:10 +01:00
sudo sh -c 'echo -ne "LANG=en_US.UTF-8\nLANGUAGE=en_US:en\nLC_CTYPE=\"en_US.UTF-8\"\nLC_NUMERIC=sv_SE.UTF-8\nLC_TIME=sv_SE.UTF-8\nLC_COLLATE=\"en_US.UTF-8\"\nLC_MONETARY=sv_SE.UTF-8\nLC_MESSAGES=en_US.UTF-8\nLC_PAPER=sv_SE.UTF-8\nLC_NAME=sv_SE.UTF-8\nLC_ADDRESS=sv_SE.UTF-8\nLC_TELEPHONE=sv_SE.UTF-8\nLC_MEASUREMENT=sv_SE.UTF-8\nLC_IDENTIFICATION=sv_SE.UTF-8\nLC_ALL=" > /etc/locale.conf'
2025-01-09 00:43:45 +01:00
# Theme
echo ""
echo "Installing Dracula theme..."
2025-01-09 04:05:14 +01:00
sudo rm -rf /usr/share/themes/Dracula
2025-01-09 00:43:45 +01:00
sudo git clone https://github.com/dracula/gtk.git /usr/share/themes/Dracula
# Force dark mode in GNOME
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
# Icons
git clone https://github.com/vinceliuice/vimix-icon-theme.git ~/vimix && cd ~/vimix && sudo ./install.sh -a && rm -rf ~/vimix`
# Font Manager
sudo zypper --non-interactive install font-manager && sudo zypper --non-interactive remove gnome-font-viewer
# Nerd Fonts
# Hack
curl -fLo font.tar.xz \
https://github.com/ryanoasis/nerd-fonts/releases/latest/download/Hack.tar.xz && \
sudo mkdir -p /usr/share/fonts/Hack && sudo tar -xf font.tar.xz -C /usr/share/fonts/Hack && \
rm -f font.tar.xz`
# Segoe UI
curl -fLo font.zip \
https://aka.ms/SegoeUIVariable && \
sudo mkdir -p /usr/share/fonts/SegoeUI && sudo unzip -o font.zip -d /usr/share/fonts/SegoeUI && \
rm -f font.zip
# FiraCode
curl -fLo font.tar.xz \
https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FiraCode.tar.xz && \
sudo mkdir -p /usr/share/fonts/FiraCode && sudo tar -xf font.tar.xz -C /usr/share/fonts/FiraCode && \
rm -f font.tar.xz
# Cascadia Cove/Code
curl -fLo font.tar.xz \
https://github.com/ryanoasis/nerd-fonts/releases/latest/download/CascadiaCode.tar.xz && \
sudo mkdir -p /usr/share/fonts/CascadiaCove && sudo tar -xf font.tar.xz -C /usr/share/fonts/CascadiaCove && \
rm -f font.tar.xz
# JetBrainsMono
curl -fLo font.tar.xz \
https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.tar.xz && \
sudo mkdir -p /usr/share/fonts/JetBrainsMono && sudo tar -xf font.tar.xz -C /usr/share/fonts/JetBrainsMono && \
rm -f font.tar.xz
# GNOME Accessibility
sudo zypper --non-interactive install at-spi2-core
# Wine
sudo zypper --non-interactive install -l wine wine-gecko wine-mono dosbox winetricks
wine start cmd /c exit
# Wine Associations
echo -e "\n\n[Default Applications]\napplication/x-ms-dos-executable=wine.desktop;\napplication/vnd.microsoft.portable-executable=wine.desktop;\napplication/x-msdownload=wine.desktop;" >> "$HOME/.config/mimeapps.list"
# Thunderbird
sudo zypper --non-interactive install thunderbird
# Vim
sudo zypper --non-interactive install vim gvim
mkdir -p ~/.vim
touch ~/.vim/vimrc
# Albert
sudo zypper --non-interactive --gpg-auto-import-keys addrepo -cf https://download.opensuse.org/repositories/home:manuelschneid3r/openSUSE_Tumbleweed/home:manuelschneid3r.repo
2025-01-09 00:43:45 +01:00
sudo zypper --non-interactive install albert
# Albert Autostart
mkdir -p ~/.config/autostart
cat <<EOF > ~/.config/autostart/albert.desktop
[Desktop Entry]
Type=Application
Name=Albert
Exec=albert
EOF
# Alacritty
sudo zypper --non-interactive install alacritty
# Bitwarden
sudo zypper --non-interactive install bitwarden
# Telegram
curl -o "$HOME/Downloads/telegram.tar.xz" https://telegram.org/dl/desktop/linux -L
sudo tar -xf "$HOME/Downloads/telegram.tar.xz" -C "/opt"
rm "$HOME/Downloads/telegram.tar.xz"
2025-01-09 04:23:38 +01:00
sudo ln -sf "/opt/Telegram/Telegram" "/usr/bin/telegram-desktop"
2025-01-09 00:43:45 +01:00
# Start Telegram to get a .desktop file, then close it
telegram-desktop -startintray &
sleep 5
killall telegram-desktop
2025-01-09 04:02:26 +01:00
killall Telegram
2025-01-09 02:11:08 +01:00
# Auto start Telegram
2025-01-09 04:15:52 +01:00
cat <<EOF > "$XDG_CONFIG_HOME/autostart/org.telegram.desktop"
2025-01-09 02:11:08 +01:00
[Desktop Entry]
Type=Application
Name=Telegram
Exec=telegram-desktop -startintray
2025-01-09 02:11:08 +01:00
Icon=telegram
EOF
2025-01-09 00:43:45 +01:00
# Steam
sudo zypper --non-interactive install -l steam
2025-01-09 02:11:08 +01:00
# Auto start Steam
cat <<EOF > "$XDG_CONFIG_HOME/autostart/steam.desktop"
[Desktop Entry]
Type=Application
Name=Steam
Icon=steam
Exec=/usr/bin/steam -silent
EOF
# Mangohud, Gamemode, Goverlay & Gamescope
2025-01-09 02:32:10 +01:00
sudo zypper --non-interactive install gamemode mangohud goverlay gamescope
2025-01-09 02:11:08 +01:00
# Enable MangoHud globally
2025-01-09 02:32:10 +01:00
# Check if MangoHud is enabled globally
if ! grep -q "MANGOHUD=1" /etc/environment; then
echo -n "Do you want to enable MangoHud globally? [y/N]: "
read MANGOHUD_GLOBAL
if [ "$MANGOHUD_GLOBAL" == "y" ]; then
echo "Enabling MangoHud globally..."
sudo sh -c 'echo -e "MANGOHUD=1" >> /etc/environment'
# Hide MangoHud by default
# RShift+F12 - Toggle overlay
# RShift+F11 - Change overlay position
# LShift+F2 - Toggle logging
# LShift+F4 - Reload config
mkdir -p ~/.config/MangoHud && echo -e "preset=3\nno_display" > ~/.config/MangoHud/MangoHud.conf
else
echo "MangoHud will not be enabled globally."
fi
fi
2025-01-09 02:11:08 +01:00
# Heroic Games Launcher (Epic, GOG, Amazon)
curl -L https://api.github.com/repos/Heroic-Games-Launcher/HeroicGamesLauncher/releases/latest | grep "browser_download_url.*rpm" | cut -d : -f 2,3 | tr -d \" | wget --show-progress -qi - && sudo rpm -i --nodeps heroic-*_64.rpm && rm -f heroic-*_64.rpm
# Auto start Heroic
cat <<EOF > "$XDG_CONFIG_HOME/autostart/heroic.desktop"
[Desktop Entry]
Type=Application
Name=Heroic Games Launcher
Exec=heroic
EOF
# BlitzMax
# Todo
# Avidemux
sudo zypper --non-interactive install avidemux3-qt5
# qBitTorrent
sudo zypper --non-interactive install qbittorrent
# OBS Studio
sudo zypper --non-interactive install obs-studio
# Audacity
sudo zypper --non-interactive install audacity
# Audacious
sudo zypper --non-interactive install audacious
# Krita
sudo zypper --non-interactive install krita
# tmux
sudo zypper --non-interactive install tmux
mkdir -p $XDG_CONFIG_HOME/tmux
touch $XDG_CONFIG_HOME/tmux/tmux.conf
2025-01-09 02:32:10 +01:00
# Ask to add tmux to .bashrc
echo -n "Do you want to start tmux automatically when you open a terminal? [y/N]: "
read TMUX_START
if [ "$TMUX_START" == "y" ]; then
echo "Adding tmux to .bashrc..."
cat <<'EOF' >> "$HOME/.bashrc"
# Start tmux
2025-01-09 02:11:08 +01:00
if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
# Check if there are any existing tmux sessions
if tmux list-sessions &> /dev/null; then
# Attach to the first available session
exec tmux attach-session -t "$(tmux list-sessions -F '#{session_name}' | head -n 1)"
else
# Create a new session if no sessions exist
exec tmux
fi
2025-01-09 02:11:08 +01:00
fi
EOF
2025-01-09 02:32:10 +01:00
else
echo "tmux will not start automatically."
fi
2025-01-09 02:11:08 +01:00
# tmux Plugin Manager
2025-01-09 04:02:26 +01:00
rm -rf ~/.tmux/plugins/tpm
2025-01-09 02:11:08 +01:00
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# Floorp browser
# https://github.com/Floorp-Projects/Floorp/releases/download/v11.22.0/floorp-11.22.0.linux-x86_64.tar.bz2
curl -L "$(curl -s https://api.github.com/repos/Floorp-Projects/Floorp/releases/latest | jq -r '.assets[] | select(.name | test("linux-x86_64.tar.bz2")) | .browser_download_url')" -o "$HOME/Downloads/floorp.tar.bz2"
sudo tar -xf "$HOME/Downloads/floorp.tar.bz2" -C "/opt"
2025-01-09 02:11:08 +01:00
rm "$HOME/Downloads/floorp.tar.bz2"
2025-01-09 04:02:26 +01:00
sudo ln -sf "/opt/floorp/floorp" "/usr/bin/floorp"
2025-01-09 04:15:52 +01:00
cat <<EOF > "$HOME/floorp.desktop"
2025-01-09 02:11:08 +01:00
[Desktop Entry]
Categories=Network;WebBrowser;GTK;
Encoding=UTF-8
Name=Floorp
GenericName=Web Browser
TryExec=/opt/floorp/floorp
Exec=/opt/floorp/floorp %u
Icon=/opt/floorp/browser/chrome/icons/default/default128.png
StartupNotify=true
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;application/x-xpinstall;x-scheme-handler/http;x-scheme-handler/https;
Comment=Browse the Web
Actions=new-window;PrivateBrowsing;ProfileManager
[Desktop Action new-window]
Name=New Window
Exec=/opt/floorp/floorp --new-window %u
[Desktop Action PrivateBrowsing]
Name=New Private Browsing Window
Exec=/opt/floorp/floorp --private-window %u
[Desktop Action ProfileManager]
Name=Profile Manager
Exec=/opt/floorp/floorp --ProfileManager
EOF
2025-01-09 04:15:52 +01:00
sudo mv "$HOME/floorp.desktop" "/usr/share/applications/floorp.desktop"
2025-01-09 00:43:45 +01:00
2025-01-09 02:11:08 +01:00
# Bash AI
curl -sS https://raw.githubusercontent.com/hezkore/bash-ai/main/install.sh | bash
2025-01-09 00:43:45 +01:00
# Screensavers
sudo zypper --non-interactive install xscreensaver-data xscreensaver-data-extra rss-glx
2025-01-09 02:11:08 +01:00
# Build Essentials
sudo zypper --non-interactive install gcc-c++ libXxf86vm-devel webkit2gtk3-devel alsa-lib-devel freetype-devel libpulse-devel glu-devel libudev-devel libXss-devel make ninja
2025-01-09 02:32:10 +01:00
2025-01-09 07:26:36 +01:00
# Use SYSTEMD_SLEEP_FREEZE_USER_SESSIONS=false to prevent freezing when suspending
sudo mkdir -p /etc/systemd/system/systemd-suspend.service.d/
sudo sh -c 'echo -e "[Service]\nEnvironment=\"SYSTEMD_SLEEP_FREEZE_USER_SESSIONS=false\"" > /etc/systemd/system/systemd-suspend.service.d/disable_freeze_user_session.conf'
# Set gpgcheck to 0 in /etc/zypp/zypp.conf to disable scary warnings no one pays attention to
if ! grep -q "^gpgcheck = 0" /etc/zypp/zypp.conf; then
echo "Disabling GPG checks for when installing packages..."
sudo sed -i 's/gpgcheck = 1/gpgcheck = 0/g' /etc/zypp/zypp.conf
# Did it work?
if grep -q "gpgcheck = 0" /etc/zypp/zypp.conf; then
echo "GPG check is now disabled."
else
echo "Failed to disable GPG check."
fi
else
echo "GPG checks for when installing packages are disabled."
fi
2025-01-09 03:12:12 +01:00
# Tell the user we're done
2025-01-09 02:32:10 +01:00
echo
echo "All done!"
echo "You must reboot your system, otherwise things will not work as expected."
exit 0