Files
HomeLAB/LXC-Debian/PVE01_LXC_Debian_Apt-Cache.sh
2025-04-11 11:47:25 +02:00

59 lines
1.8 KiB
Bash

#!/bin/bash
#
# Check if user is root
#
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use the root user to install the software."
exit 1
fi
if [ ! -f /etc/debian_version ]; then
echo "Unsupported Linux Distribution. Prepared for Debian"
exit 1
fi
################################################################################
#
# Hostname: aptcache.dmz.lan
#
# IP: 192.168.50.10/24
#
# URL: http://192.168.50.10:3142/acng-report.html
#
# OS: Debain 12
#
# Container ID: 100
#
# Node: PVE01
#
################################################################################
#
apt install -y \
avahi-daemon \
apt-cacher-ng \
apt-listchanges \
apt-transport-https
# mkdir /var/cache/apt-cacher-ng/_import
# chown -R apt-cacher-ng /var/cache/apt-cacher-ng/_import
echo "PassThroughPattern: ^(.*):443$" >> /etc/apt-cacher-ng/acng.conf
echo -e '\033[33m------Setup Apt-Sources and Upgrade System------\033[33m'
echo -e "\033[0m"
sleep 2
mv /etc/apt/sources.list /etc/apt/sources.list.default
cat > /etc/apt/sources.list <<"EOF"
#deb http://127.0.0.1:3142/ftp.de.debian.org/debian/ stable main contrib non-free non-free-firmware
#deb http://127.0.0.1:3142/ftp.de.debian.org/debian/ stable-updates main contrib non-free non-free-firmware
#deb http://127.0.0.1:3142/security.debian.org/ stable/updates main contrib non-free non-free-firmware
deb http://127.0.0.1:3142/deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb http://127.0.0.1:3142/deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
deb http://127.0.0.1:3142/deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb http://127.0.0.1:3142/ftp.debian.org/debian bookworm-backports main contrib non-free non-free-firmware
EOF
apt autoremove && apt autoclean && apt clean