add start of isntll script

This commit is contained in:
2026-08-25 21:44:25 +02:00
parent 2ad8c88c2d
commit 52a27f3325
2 changed files with 93 additions and 0 deletions
View File
+93
View File
@@ -0,0 +1,93 @@
#!/usr/bin/env bash
set -u
# Python bereits vorhanden?
if command -v python3 >/dev/null 2>&1; then
echo "Python ist bereits installiert:"
python3 --version
exit 0
fi
echo "Python 3 wurde nicht gefunden."
# OS erkennen
if [[ -f /etc/os-release ]]; then
. /etc/os-release
else
echo "Konnte das Betriebssystem nicht erkennen."
exit 1
fi
# Paketmanager bestimmen
case "$ID" in
debian|ubuntu|linuxmint|pop)
PKG_MANAGER="apt"
INSTALL_CMD="sudo apt install --yes python3"
;;
arch|manjaro|endeavouros)
PKG_MANAGER="pacman"
INSTALL_CMD="sudo pacman -S --noconfirm python"
;;
fedora)
PKG_MANAGER="dnf"
INSTALL_CMD="sudo dnf install -y python3"
;;
rhel|centos|rocky|almalinux)
PKG_MANAGER="dnf"
INSTALL_CMD="sudo dnf install -y python3"
;;
opensuse*|sles)
PKG_MANAGER="zypper"
INSTALL_CMD="sudo zypper --non-interactive install python3"
;;
alpine)
PKG_MANAGER="apk"
INSTALL_CMD="sudo apk add python3"
;;
void)
PKG_MANAGER="xbps-install"
INSTALL_CMD="sudo xbps-install -Sy python3"
;;
gentoo)
PKG_MANAGER="emerge"
INSTALL_CMD="sudo emerge dev-lang/python"
;;
*)
echo "Unbekanntes Betriebssystem:"
echo " $PRETTY_NAME"
echo " ID=$ID"
exit 1
;;
esac
echo
echo "OS: $PRETTY_NAME"
echo "Paketmanager: $PKG_MANAGER"
echo "Installation: $INSTALL_CMD"
echo
read -r -p "Python 3 jetzt installieren? [j/N] " answer
case "$answer" in
j|J|ja|Ja|JA)
echo
echo "Installiere Python 3..."
eval "$INSTALL_CMD"
;;
*)
echo "Installation abgebrochen."
exit 0
;;
esac
# Prüfen, ob Installation erfolgreich war
if command -v python3 >/dev/null 2>&1; then
echo
echo "Python wurde erfolgreich installiert:"
python3 --version
else
echo
echo "Python konnte nicht gefunden werden. Die Installation ist möglicherweise fehlgeschlagen."
exit 1
fi