Files
pve-pbs-setup/set_repos.sh

115 lines
3.6 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# =====================================================
# Proxmox VE 9 Repository Setup
# Debian 13 (trixie) | deb822 (.sources)
# Enterprise -> No-Subscription
# =====================================================
# Farben / Layout (Community-Style)
BOLD="\033[1m"
GREEN="\033[32m"
YELLOW="\033[33m"
RED="\033[31m"
CYAN="\033[36m"
RESET="\033[0m"
INDENT=" "
# Root-Check
if [[ $EUID -ne 0 ]]; then
echo -e "${RED}${INDENT}Bitte als Root ausführen!${RESET}"
exit 1
fi
echo -e "${BOLD}${CYAN}"
echo -e "${INDENT}=============================================="
echo -e "${INDENT} Proxmox VE 9 Repository Setup"
echo -e "${INDENT} No-Subscription | deb822 Standard"
echo -e "${INDENT}=============================================="
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
KEYRING="/usr/share/keyrings/proxmox-archive-keyring.gpg"
if [[ ! -f "$KEYRING" ]]; then
echo -e "${CYAN}${INDENT}==> Proxmox Keyring fehlt installiere...${RESET}"
apt update >/dev/null
apt install -y proxmox-archive-keyring
fi
# -----------------------------------------------------
# Ceph Codename ermitteln (Major -> Codename)
# -----------------------------------------------------
CEPH_CODENAME="squid" # Default für PVE9
if command -v ceph >/dev/null 2>&1; then
CEPH_MAJOR=$(ceph -v | awk '{print $3}' | cut -d. -f1)
case "$CEPH_MAJOR" in
16) CEPH_CODENAME="pacific" ;;
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
URIs: http://download.proxmox.com/debian/pve
Suites: trixie
Components: pve-no-subscription
Signed-By: ${KEYRING}
EOF
# -----------------------------------------------------
# Ceph No-Subscription Repo
# -----------------------------------------------------
echo -e "${CYAN}${INDENT}==> Erstelle Ceph No-Subscription Repo...${RESET}"
cat <<EOF > /etc/apt/sources.list.d/ceph-no-subscription.sources
Types: deb
URIs: http://download.proxmox.com/debian/ceph-${CEPH_CODENAME}
Suites: trixie
Components: main
Signed-By: ${KEYRING}
EOF
# -----------------------------------------------------
# APT Update
# -----------------------------------------------------
echo -e "${CYAN}${INDENT}==> APT Update...${RESET}"
apt update
echo
echo -e "${GREEN}${INDENT}✔ Repositories erfolgreich eingerichtet!${RESET}"
echo -e "${CYAN}${INDENT}PVE 9 nutzt jetzt No-Subscription Repos.${RESET}"
echo -e "${CYAN}${INDENT}Ceph Repo: ceph-${CEPH_CODENAME}${RESET}"