Skip to content

Instantly share code, notes, and snippets.

@yashi
Created March 18, 2025 11:10
Show Gist options
  • Save yashi/1329ec6b9f54061d44a763268698eb93 to your computer and use it in GitHub Desktop.
Save yashi/1329ec6b9f54061d44a763268698eb93 to your computer and use it in GitHub Desktop.
Disable Apt Cacher while on the go
#!/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