set_repos.sh aktualisiert

This commit is contained in:
2026-01-23 21:56:39 +01:00
parent 7e805c7c52
commit 6a86f1d238

View File

@@ -1,22 +1,20 @@
#!/bin/bash #!/bin/bash
# ===================================================== # =====================================================
# Proxmox VE 9 Repository Setup # Proxmox VE 9 Repository Setup (No-Subscription)
# Debian 13 (trixie) | deb822 (.sources) # Debian 13 (trixie) | deb822 (.sources)
# Enterprise -> No-Subscription # Enterprise -> No-Subscription
# ===================================================== # =====================================================
# Farben / Layout (Community-Style) # Farben / Layout
BOLD="\033[1m" BOLD="\033[1m"
GREEN="\033[32m" GREEN="\033[32m"
YELLOW="\033[33m"
RED="\033[31m"
CYAN="\033[36m" CYAN="\033[36m"
RESET="\033[0m" RESET="\033[0m"
INDENT=" " INDENT=" "
# Root-Check # Root-Check
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
echo -e "${RED}${INDENT}Bitte als Root ausführen!${RESET}" echo -e "${INDENT}${BOLD}Bitte als Root ausführen!${RESET}"
exit 1 exit 1
fi fi
@@ -27,88 +25,61 @@ echo -e "${INDENT} No-Subscription | deb822 Standard"
echo -e "${INDENT}==============================================" echo -e "${INDENT}=============================================="
echo -e "${RESET}" echo -e "${RESET}"
# OS-Check (PVE9 = Debian 13)
if ! grep -q "trixie" /etc/os-release; then
echo -e "${RED}${INDENT}Dieses Script ist NUR für Proxmox VE 9 (Debian 13)!${RESET}"
exit 1
fi
# Backup-Ordner
BACKUP_DIR="/root/repo-backup-$(date +%F-%H%M)"
mkdir -p "$BACKUP_DIR"
echo -e "${CYAN}${INDENT}==> Backup vorhandener Repo-Dateien...${RESET}"
# Alte Repos sichern
[ -f /etc/apt/sources.list ] && mv /etc/apt/sources.list "$BACKUP_DIR/"
mv /etc/apt/sources.list.d/*.list "$BACKUP_DIR/" 2>/dev/null
mv /etc/apt/sources.list.d/*.sources "$BACKUP_DIR/" 2>/dev/null
echo -e "${GREEN}${INDENT}Backup erstellt unter: $BACKUP_DIR${RESET}"
# Proxmox Keyring prüfen # Proxmox Keyring prüfen
KEYRING="/usr/share/keyrings/proxmox-archive-keyring.gpg" KEYRING="/usr/share/keyrings/proxmox-archive-keyring.gpg"
if [[ ! -f "$KEYRING" ]]; then if [[ ! -f "$KEYRING" ]]; then
echo -e "${CYAN}${INDENT}==> Proxmox Keyring fehlt installiere...${RESET}" echo -e "${INDENT}==> Proxmox Keyring fehlt installiere..."
apt update >/dev/null apt update >/dev/null
apt install -y proxmox-archive-keyring apt install -y proxmox-archive-keyring
fi fi
# ----------------------------------------------------- # -----------------------------------------------------
# Ceph Codename ermitteln (Major -> Codename) # PVE Repos
# ----------------------------------------------------- # -----------------------------------------------------
CEPH_CODENAME="squid" # Default für PVE9
if command -v ceph >/dev/null 2>&1; then # pve-enterprise.disabled
CEPH_MAJOR=$(ceph -v | awk '{print $3}' | cut -d. -f1) cat <<EOF > /etc/apt/sources.list.d/pve-enterprise.sources
Types: deb
URIs: https://enterprise.proxmox.com/debian/pve
Suites: trixie
Components: pve-enterprise
Signed-By: ${KEYRING}
Enabled: false
EOF
case "$CEPH_MAJOR" in # pve-no-subscription.enabled
16) CEPH_CODENAME="pacific" ;; cat <<EOF > /etc/apt/sources.list.d/proxmox.sources
17) CEPH_CODENAME="quincy" ;;
18) CEPH_CODENAME="reef" ;;
19) CEPH_CODENAME="squid" ;;
*)
echo -e "${YELLOW}${INDENT}Unbekannte Ceph-Version ($CEPH_MAJOR), nutze 'squid'${RESET}"
CEPH_CODENAME="squid"
;;
esac
fi
echo -e "${CYAN}${INDENT}==> Ceph Codename: ${CEPH_CODENAME}${RESET}"
# -----------------------------------------------------
# PVE No-Subscription Repo
# -----------------------------------------------------
echo -e "${CYAN}${INDENT}==> Erstelle PVE No-Subscription Repo...${RESET}"
cat <<EOF > /etc/apt/sources.list.d/pve-no-subscription.sources
Types: deb Types: deb
URIs: http://download.proxmox.com/debian/pve URIs: http://download.proxmox.com/debian/pve
Suites: trixie Suites: trixie
Components: pve-no-subscription Components: pve-no-subscription
Signed-By: ${KEYRING} Signed-By: ${KEYRING}
Enabled: true
EOF EOF
# ----------------------------------------------------- # ceph.sources (Enterprise Disabled + No-Subscription Enabled)
# Ceph No-Subscription Repo cat <<EOF > /etc/apt/sources.list.d/ceph.sources
# -----------------------------------------------------
echo -e "${CYAN}${INDENT}==> Erstelle Ceph No-Subscription Repo...${RESET}"
cat <<EOF > /etc/apt/sources.list.d/ceph-no-subscription.sources
Types: deb Types: deb
URIs: http://download.proxmox.com/debian/ceph-${CEPH_CODENAME} URIs: https://enterprise.proxmox.com/debian/ceph-squid
Suites: trixie Suites: trixie
Components: main Components: enterprise
Signed-By: ${KEYRING} Signed-By: ${KEYRING}
Enabled: false
Types: deb
URIs: http://download.proxmox.com/debian/ceph-squid
Suites: trixie
Components: no-subscription
Signed-By: ${KEYRING}
Enabled: true
EOF EOF
# ----------------------------------------------------- # -----------------------------------------------------
# APT Update # APT Update
# ----------------------------------------------------- # -----------------------------------------------------
echo -e "${CYAN}${INDENT}==> APT Update...${RESET}" echo -e "${INDENT}==> APT Update..."
apt update apt update
echo echo
echo -e "${GREEN}${INDENT}✔ Repositories erfolgreich eingerichtet!${RESET}" echo -e "${GREEN}${INDENT}✔ Repositories erfolgreich eingerichtet!${RESET}"
echo -e "${CYAN}${INDENT}PVE 9 nutzt jetzt No-Subscription Repos.${RESET}" echo -e "${INDENT}PVE 9 + Ceph (squid) nutzen jetzt No-Subscription."
echo -e "${CYAN}${INDENT}Ceph Repo: ceph-${CEPH_CODENAME}${RESET}"