Add an OpenSuSE Tumbleweed setup script
This commit is contained in:
1 parent
00b97f19d4
commit
78e195ccde
1 file changed
+236
@@ -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 <<EOF
|
||||||
|
|
||||||
|
=== Setup completed at $(date --iso-8601=seconds) ===
|
||||||
|
Check log: $LOGFILE
|
||||||
|
|
||||||
|
Manual follow-up:
|
||||||
|
|
||||||
|
1. Verify Plasma session at login if needed.
|
||||||
|
2. Verify Packman repo:
|
||||||
|
zypper lr -d
|
||||||
|
3. Verify multimedia packages:
|
||||||
|
zypper se -si ffmpeg gstreamer-plugins-libav
|
||||||
|
4. Find UUIDs:
|
||||||
|
lsblk -f
|
||||||
|
5. Back up fstab:
|
||||||
|
sudo cp /etc/fstab /etc/fstab.bak
|
||||||
|
6. Add entries like these:
|
||||||
|
|
||||||
|
# ext4 games partition
|
||||||
|
UUID=XXXXXX-XXXX /mnt/games ext4 defaults,nofail 0 2
|
||||||
|
|
||||||
|
# media partition if NTFS
|
||||||
|
UUID=YYYYYY-YYYY /mnt/media ntfs3 defaults,nofail,uid=1000,gid=1000 0 0
|
||||||
|
|
||||||
|
7. Test mounts:
|
||||||
|
sudo mount -a
|
||||||
|
|
||||||
|
8. Fix ownership if needed:
|
||||||
|
sudo chown -R ${REAL_USER}:${REAL_USER} /mnt/games
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
- KDE Plasma patterns are installed with: zypper install -t pattern kde kde_plasma
|
||||||
|
- Packman is the important multimedia repo on Tumbleweed.
|
||||||
|
- Signal Desktop is installed via Flatpak.
|
||||||
|
- If you started from a KDE install image, the KDE pattern step is mostly harmless.
|
||||||
|
EOF
|
||||||
Reference in new issue
Block a user