no subscription

vi /etc/apt/sources.list.d/pve-enterprise.list
comment
deb https://enterprise.proxmox.com/debian/pve bookworm pve-enterprise

vi /etc/apt/sources.list
add:
deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription

vi /etc/apt/sources.list.d/ceph.list
comment existing, and add:

deb http://download.proxmox.com/debian/ceph-reef bookworm no-subscription

vi /etc/apt/preferences.d/99-proxmox-ceph
add:

Package: *
Pin: release o=Proxmox
Pin-Priority: 1001

#!/bin/bash

# Define file paths
PVE_ENTERPRISE_LIST="/etc/apt/sources.list.d/pve-enterprise.list"
SOURCES_LIST="/etc/apt/sources.list"
CEPH_LIST="/etc/apt/sources.list.d/ceph.list"
PREFERENCES_FILE="/etc/apt/preferences.d/99-proxmox-ceph"

# Comment out the pve-enterprise repository in /etc/apt/sources.list.d/pve-enterprise.list
echo "Commenting out the pve-enterprise repository in $PVE_ENTERPRISE_LIST..."
if [ -f "$PVE_ENTERPRISE_LIST" ]; then
    sudo sed -i 's|^deb https://enterprise.proxmox.com/debian/pve bookworm pve-enterprise|#deb https://enterprise.proxmox.com/debian/pve bookworm pve-enterprise|' "$PVE_ENTERPRISE_LIST"
else
    echo "File $PVE_ENTERPRISE_LIST does not exist."
fi

# Add the Proxmox no-subscription repository to /etc/apt/sources.list
echo "Adding Proxmox no-subscription repository to $SOURCES_LIST..."
if ! grep -q "^deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription" "$SOURCES_LIST"; then
    echo "deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription" | sudo tee -a $SOURCES_LIST > /dev/null
else
    echo "Proxmox no-subscription repository already exists in $SOURCES_LIST."
fi

# Comment out existing entries in /etc/apt/sources.list.d/ceph.list and add the no-subscription Ceph repository
echo "Updating $CEPH_LIST..."
if [ -f "$CEPH_LIST" ]; then
    sudo sed -i 's/^deb /#deb /g' "$CEPH_LIST"
else
    echo "File $CEPH_LIST does not exist, creating it..."
    sudo touch "$CEPH_LIST"
fi
echo "deb http://download.proxmox.com/debian/ceph-reef bookworm no-subscription" | sudo tee -a $CEPH_LIST > /dev/null

# Add preferences to /etc/apt/preferences.d/99-proxmox-ceph
echo "Adding package preferences to $PREFERENCES_FILE..."
sudo mkdir -p /etc/apt/preferences.d
cat <<EOF | sudo tee $PREFERENCES_FILE > /dev/null
Package: *
Pin: release o=Proxmox
Pin-Priority: 1001
EOF

# Output success message
echo "Configuration completed successfully."