Created
March 18, 2025 11:10
-
-
Save yashi/1329ec6b9f54061d44a763268698eb93 to your computer and use it in GitHub Desktop.
Disable Apt Cacher while on the go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
MY_CACHER= | |
IFACE=$1 | |
STATUS=$2 | |
THE_LINE="Acquire::http::Proxy \"http://$MY_CACHER:3142\";" | |
THE_FILE="/etc/apt/apt.conf.d/02proxy-ng" | |
if [ x"$STATUS" = x"up" ]; then | |
if tailscale ping --c 1 --timeout 1s $MY_CACHER > /dev/null; then | |
echo $THE_LINE | tee $THE_FILE | |
echo "Activate Apt-Cacher NG" | |
else | |
# Make it empty | |
echo "" | tee $THE_FILE | |
echo "Disable Apt-Cacher NG" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment