This repository has been archived by the owner on Nov 2, 2024. It is now read-only.
apt-cacher-ng related script #2474
mattvanmater
started this conversation in
Ideas
Replies: 3 comments
-
That sounds like a fantastic idea! I definitely plan to include it in the scripts. |
Beta Was this translation helpful? Give feedback.
0 replies
-
It has been added. ffd2fc3 |
Beta Was this translation helpful? Give feedback.
0 replies
-
For anyone wanting to switch to this method, change
It will overwrite your previous |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I noticed you recently added a apt-cacher-ng LXC to your scripts! I've been running my own apt-cacher-ng for a long time now and I thought I would share a script that i've found useful. If the apt-cacher proxy is not available for any reason, any LXC or VM that depends upon it will hang when trying to perform apt-update through the apt proxy. This script will check to see if the proxy is available prior to trying to use it, and if not it will directly communicate with your apt repos.
The script:
`echo "Acquire::http::Proxy-Auto-Detect "/usr/local/bin/apt-proxy-detect.sh";" >> /etc/apt/apt.conf.d/00aptproxy
cat > /usr/local/bin/apt-proxy-detect.sh <<'EOF'
#!/bin/bash
IP=---your DNS name or ip here---
PORT=3142
if nc -w1 -z $IP $PORT; then
echo -n "http://${IP}:${PORT}"
else
echo -n "DIRECT"
fi
EOF
chmod +x /usr/local/bin/apt-proxy-detect.sh`
Perhaps you can re-use it somewhere (install.func, build.func, automatically inject it into containers and VMs?). The script above is the first thing I run after building a new Debian based LXC or VM.
Side note: I also have it running on my Linux based laptops. It is particularly useful / important if i take my laptop away from my home and I need to update/install software. I realize it's not applicable for most proxmox environments, but it's handy to have and be consistent across all hosts both physical and virtual.
Beta Was this translation helpful? Give feedback.
All reactions