apt-cacher-ng related program and package suggestion
Hello, I have a suggestion for a client program/package in combination with apt-cacher-ng Consider following situation: User U_A has a laptop which he uses at home and at university He has a poor internet connection in both places. So he set up apt-cacher-ng services in both places but they are on different networks (he does not have permission to change the network settings at university to make the IP addresses of the apt-cacher-ng servers math) Lets say at home the server HOST_1 is http://192.168.1.100:3142 At university: server: HOST_2: http://192.168.76.56:3142 He uses Ubuntu (so this should work for Debian in a similar way). He makes a backup "/etc/apt/sources.list.bak" of /etc/apt/sources.list At university he sets up the cache repo as follows (after overwriting the /etc/apt/sources.list with a copy of the backup if it was changed to use the home apt-cacher-ng) sed -i 's/de.archive.ubuntu.com/192.168.76.56:3142/g' /etc/apt/sources.list The same procedure at home. The shown way is not very comfortable. 1. it is annoying having to remember IP addresses 2. sed command is error prone (consider typos, etc.) 3. copying around backup files is time consuming having to type in all the paths 4. typing in sed command or searching it in bash history for re-using is time consuming, too. What I would like is to setup all cachers one use a program (lets call it apt-cacher-switch for now) apt-cacher-switch add :> apt-cacher-switch add :> Then at university: apt-cacher-switch enable At home: apt-cacher-switch enable In an environment where no cacher is on the network apt-cacher-switch disable The apt-cacher switch should manage creating and copying around the required /etc/apt/sources.list files. As I am not very talented in C/C++ programming under Linux, I am asking the community to make it happen. I would be very happy if this could be implemented and the package be added to the official Debian and Ubuntu (and other derivates') repositories. Best regards Chris
Re: apt-cacher-ng related program and package suggestion
Thanks for the tips. Like I said, I'd prefer a program that does all this in the background by calling one simple command On 15-Jun-17 4:38 PM, David Wright wrote: > On Thu 15 Jun 2017 at 10:16:45 (-0400), Dan Ritter wrote: >> On Wed, Jun 14, 2017 at 09:57:50PM +0200, tuxderlinuxfuch...@gmail.com wrote: >>> The shown way is not very comfortable. >>> >>> 1. it is annoying having to remember IP addresses >>> 2. sed command is error prone (consider typos, etc.) >>> 3. copying around backup files is time consuming having to type in all >>> the paths >>> 4. typing in sed command or searching it in bash history for re-using is >>> time consuming, too. >>> >> 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. > Another workaround is to use bash functions, say upgrade-work and > upgrade-home, to wrap some rather long command lines like: > > apt-get -o Acquire::http::Proxy="http://192.168.1.19:3142/"; update && apt-get > -d -o Acquire::http::Proxy="http://192.168.1.19:3142/"; upgrade ; apt-get > upgrade > > Now you may well ask why I use such a crazy command line. > Answer, I run apt-cacher-ng on my wheezy server, BUT > proxying the actual upgrade step fails because wheezy can't > handle apt-listbugs, so I do that step directly. The long > command line saves messing with apt.conf or sources.list. > > Cheers, > David. >