Files
pve-pbs-setup/set_repos.sh

87 lines
2.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 (No-Subscription)
# Debian 13 (trixie) | deb822 (.sources)
# =====================================================
# Farben / Layout
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 prüfen
if ! grep -q "trixie" /etc/os-release; then
echo -e "${RED}${INDENT}Dieses Script ist NUR für Debian 13 (trixie)!${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}"
mv /etc/apt/sources.list.d/*.list "$BACKUP_DIR/" 2>/dev/null
mv /etc/apt/sources.list.d/*.sources "$BACKUP_DIR/" 2>/dev/null
[ -f /etc/apt/sources.list ] && mv /etc/apt/sources.list "$BACKUP_DIR/"
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 Version dynamisch bestimmen
CEPH_CODENAME="squid"
if command -v ceph >/dev/null 2>&1; then
CEPH_CODENAME=$(ceph -v | awk '{print $3}' | cut -d. -f1)
fi
echo -e "${CYAN}${INDENT}==> Erkannte Ceph-Version: ${CEPH_CODENAME}${RESET}"
# PVE 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 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 -e "${GREEN}${INDENT}✔ Repositories erfolgreich eingerichtet!${RESET}"
echo -e "${CYAN}${INDENT}PVE 9 + Ceph (${CEPH_CODENAME}) nutzen jetzt No-Subscription.${RESET}"