Re: apt-cacher-ng related program and package suggestion
- Date: Fri, 16 Jun 2017 11:46:13 -0400
- From: Dan Ritter <dsr@xxxxxxxxxxxxxxxx>
- Subject: Re: apt-cacher-ng related program and package suggestion
On Thu, Jun 15, 2017 at 10:44:01AM -0400, Bob Weber wrote:
> > Simple workaround for now:
> > /etc/apt/sources.list:
> > ----
> > deb http://site1.ip.address/debian jessie-backports main
> > #deb http://site2.ip.address/debian jessie-backports main
> > ----
> > Now just change the comment from one to the other, run apt-get
> > update and go.
> > Second workaround, if you have lots of entries to be switched:
> > create two sources.list files, named home.list and uni.list.
> > When you move from place to place, copy the appropriate one
> > in to /etc/apt/sources.list and run apt-get update.
> > -dsr-
> Its even easier than that. Don't mess with the .list files just change the file
> according to the login.
> The contents of that file is just the address/port of the apt-cacher-ng server.
> Acquire::http::Proxy "http://172.16.0.1:3142/";
> Just write a script to check what network you are on. Like ping the
> apt-cacher-ng server(s) until a response is sent and set
> /etc/apt/apt.conf.d/000apt-cacher-ng-proxy accordingly.
> Try the following line with your own existing and non existing ips.
> for f in 172.16.0.1 172.16.0.2 172.16.0.33; do if ping -c3 $f; then echo $f
> yes;else echo $f no;fi; done
There's a formalized version of this which might be useful:
$ apt-cache show ifscheme
Maintainer: Guus Sliepen <guus@xxxxxxxxxx>
Depends: ifupdown (>= 0.6.5)
Description-en: scheme control for network interfaces ifscheme allows you
to change network configuration schemes or query the current scheme. It
integrates with the ifup(8) command and interfaces(5). For example, you
might use this program to configure a "home" scheme and a "work" scheme
for a network device on a laptop. When you move between home and work,
a simple command can reconfigure your networking.
This could be rigged to change files when the network is