About Blog Cloud | Projects

All articles, tagged with “en”

apt caches on notebooks

Using a apt caching daemon on a notebook is usually pain. Most require to alter the /etc/apt/sources.list which is quite annoying as you have to maintain the different lists for different locations. If the daemon requires you to add repositories, third party repositories are usually not added anyways.

But there is a good solution which works great here, thanks to apt-cacher-ng. Apt-cacher-ng does not require you to alter the sources.list as it can work as a http proxy. It also does not require any configuration for repositories.

On your server simply do sudo aptitude install apt-cacher-ng

On a permanent client add a file /etc/apt/apt.conf.d/02proxy with:

Acquire::http { Proxy "http://SERVERIP:3142"; Timeout "10"; };
Acquire::HTTP::Proxy::bugs.debian.org "DIRECT";

Now to laptops. switchconf is a useful tool for this, as it can change config files depending on locations.

sudo aptitude install switchconf
sudo mkdir -p /etc/switchconf/other/etc/apt/apt.conf.d
sudo touch /etc/switchconf/other/etc/apt/apt.conf.d/02proxy
sudo mkdir -p /etc/switchconf/home/etc/apt/apt.conf.d
sudo vi /etc/switchconf/home/etc/apt/apt.conf.d/02proxy

And paste the client config there.

This adds two locations, home and other. other will not use any proxy and should therefor work everywhere and home will use your home proxy. You can of course add more locations as you have more places with proxies found.

But as you don’t want to type “sudo switchconf LOCATION” whenever you change places, some auto-detection is required. I use Network-Manager and use the dispatcher for this.

sudo vi /etc/NetworkManager/dispatcher.d/99switchconf

And this is my detection script. I use arp to test if a certain IP has a specific MAC address which is a very precise test. arp -a SERVERIP will show you the MAC address of your server.

#!/bin/bash

if [[ `arp -a 192.168.22.1` =~ 54:52:00:31:fe:a9 ]]; then
  switchconf home;
else
  switchconf other;
fi

Don’t forget to make it executeable

sudo chmod +x /etc/NetworkManager/dispatcher.d/99switchconf

Now i got cache at home and no cache on the road.

tooth

After a short but intense odyssey with a problem tooth, he is finally gone. Internal tooth resorption is a very annoying thing which can happen. The tooth didn’t show any symptoms, no pain, no changes of appearance until one day i had a small blister on the gum which looked at first like a simple infection. X-Rays showed that already a large hole existed deep inside the neck of the tooth and the internal infection pushed to create this blister. Trying to remove the root of the tooth didn’t stop the disappearing and two weeks ago, the sides of the tooth became so weak, that one side finally cracked.
Now he is gone forever and after one day pain is gone, too.

Sadly the surgeon didn’t allow me to watch, which I always do. He thought I would hinder him at his work, though I’m very skilled in navigation the mirror while someone operation in my mouth….