Web lists-archives.com

apt-cacher-ng related program and package suggestion


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
At university: server: HOST_2:

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/' /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 <Host1_Name> <http://<IP1>:<PORT1>>
apt-cacher-switch add <Host2_Name> <http://<IP2>:<PORT2>>

Then at university:
apt-cacher-switch enable <Host1_Name>

At home:
apt-cacher-switch enable <Host2_Name>

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