From 78e195ccde38ed81ddaa1404d3df45f4452e1656 Mon Sep 17 00:00:00 2001 From: Zoness Date: Tue, 14 Apr 2026 09:12:00 -0500 Subject: [PATCH] Add an OpenSuSE Tumbleweed setup script --- linux/opensuse_tumbleweed_setup.sh | 236 +++++++++++++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 linux/opensuse_tumbleweed_setup.sh diff --git a/linux/opensuse_tumbleweed_setup.sh b/linux/opensuse_tumbleweed_setup.sh new file mode 100644 index 0000000..8379c21 --- /dev/null +++ b/linux/opensuse_tumbleweed_setup.sh @@ -0,0 +1,236 @@ +#!/usr/bin/env bash + +set -Eeuo pipefail + +LOGFILE="${HOME:-/root}/opensuse-kde-setup-$(date +%Y%m%d-%H%M%S).log" +exec > >(tee -a "$LOGFILE") 2>&1 + +echo "=== openSUSE Tumbleweed KDE Setup Started at $(date --iso-8601=seconds) ===" + +if [[ ${EUID:-$(id -u)} -eq 0 ]]; then + SUDO="" + REAL_USER="${SUDO_USER:-root}" + REAL_HOME="$(getent passwd "$REAL_USER" | cut -d: -f6)" +else + SUDO="sudo" + REAL_USER="${USER}" + REAL_HOME="${HOME}" +fi + +run() { + echo + echo ">>> $*" + "$@" +} + +warn() { + echo "WARNING: $*" >&2 +} + +have_cmd() { + command -v "$1" >/dev/null 2>&1 +} + +pkg_installed() { + rpm -q "$1" >/dev/null 2>&1 +} + +pkg_install() { + local to_install=() + local pkg + + for pkg in "$@"; do + if ! pkg_installed "$pkg"; then + to_install+=("$pkg") + fi + done + + if ((${#to_install[@]} == 0)); then + echo "Packages already installed: $*" + return 0 + fi + + run $SUDO zypper install -y "${to_install[@]}" || warn "Some packages failed to install: ${to_install[*]}" +} + +flatpak_install() { + local ref + for ref in "$@"; do + if flatpak info "$ref" >/dev/null 2>&1; then + echo "Flatpak already installed: $ref" + else + run flatpak install -y flathub "$ref" || warn "Flatpak failed: $ref" + fi + done +} + +write_vscode_repo() { + run $SUDO rpm --import https://packages.microsoft.com/keys/microsoft.asc + run $SUDO tee /etc/zypp/repos.d/vscode.repo >/dev/null <<'EOF' +[code] +name=Visual Studio Code +baseurl=https://packages.microsoft.com/yumrepos/vscode +enabled=1 +autorefresh=1 +type=rpm-md +gpgcheck=1 +gpgkey=https://packages.microsoft.com/keys/microsoft.asc +EOF +} + +ensure_repo() { + local alias="$1" + local url="$2" + + if zypper lr --uri | awk '{print $2}' | grep -Fxq "$alias"; then + echo "Repository already exists: $alias" + else + run $SUDO zypper ar -cfp 90 "$url" "$alias" || warn "Failed to add repo: $alias" + fi +} + +echo "Running as: ${REAL_USER}" +echo "Real home: ${REAL_HOME}" + +echo +echo "Creating mount points..." +run $SUDO mkdir -p /mnt/games /mnt/media + +if have_cmd systemctl; then + run $SUDO systemctl daemon-reload || true +fi + +echo +echo "Refreshing repositories..." +run $SUDO zypper ref -f || warn "Initial repo refresh failed" + +echo +echo "Ensuring KDE Plasma patterns are installed..." +run $SUDO zypper install -y -t pattern kde kde_plasma || warn "KDE patterns may already be present or partially failed" + +echo +echo "Adding Packman for multimedia..." +ensure_repo packman https://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Tumbleweed/ +run $SUDO zypper ref || warn "Repo refresh after Packman failed" + +echo +echo "Upgrading system..." +run $SUDO zypper dup -y --allow-vendor-change || warn "System dup encountered errors" + +echo +echo "Switching multimedia packages to Packman where applicable..." +run $SUDO zypper dup -y --from packman --allow-vendor-change || warn "Packman vendor switch encountered errors" + +echo +echo "Installing Flatpak + Flathub..." +pkg_install flatpak +run flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + +echo +echo "Installing KDE-friendly desktop apps..." +pkg_install \ + ark \ + dolphin \ + filezilla \ + git \ + kate \ + kdeconnect-kde \ + kio-extras \ + konsole \ + okular \ + plasma-browser-integration \ + spectacle \ + yakuake + +echo +echo "Installing common apps..." +pkg_install \ + ffmpeg \ + filelight \ + fastfetch \ + gstreamer-plugins-bad \ + gstreamer-plugins-libav \ + gstreamer-plugins-ugly \ + hugo \ + MozillaThunderbird \ + NetworkManager-openvpn \ + openrgb \ + openvpn \ + qbittorrent \ + steam \ + yt-dlp + +echo +echo "Installing fonts..." +pkg_install \ + cascadia-code-fonts \ + google-droid-fonts \ + liberation-fonts \ + noto-sans-fonts \ + noto-serif-fonts +run $SUDO fc-cache -f || true + +echo +echo "Setting up VS Code..." +write_vscode_repo +run $SUDO zypper ref || warn "zypper ref after VS Code repo failed" +pkg_install code + +echo +echo "Installing optional RPM apps..." +pkg_install discord || warn "discord not available from current repos" + +echo +echo "Installing Flatpaks..." +flatpak_install \ + org.signal.Signal \ + com.bitwarden.desktop \ + io.github.martinrotter.rssguard \ + com.spotify.Client \ + io.github.Archeb.opentrace + +echo +echo "Enabling useful services..." +run $SUDO systemctl enable --now NetworkManager || warn "Could not enable NetworkManager" + +echo +echo "Ownership hint for /mnt/games..." +echo "After you mount the ext4 games partition, you may want:" +echo " sudo chown -R ${REAL_USER}:${REAL_USER} /mnt/games" + +cat <