localepurge, the Arch way

The BeagleBone Black has only 2GB as internal eMMC flash storage; 1.8GB really. Even if I’ve a very minimal setup with just 176 packages installed I often fight with free space.

The common way to free some space is purging locale files. A nice script that does this job is localepurge, made by Debian guys. You just need to configure it and then run it once after an update or after you install a new package; the best way is to setup a weekly cron task for this job. Until pacman 4.2.

In fact, 13th November ‘11, Dave Reisner pushed shell-style glob support to NoExtract pacman directive. NoExtract directive tell package manager to not install a specified file on your system (man pacman.conf for more info). This patch is part of pacman 4.1.

But that’s not enough for what I need. To override the blacklist rule by whitelisting some file we also need Patrick Steinhardt’s patch. This will be included in pacman 4.2.

Now, we can enable the NoExtract directive and we can setup it to avoid locales and translated man pages this way:

NoExtract = usr/share/locale/* !usr/share/locale/en* !usr/share/locale/locale.alias usr/share/man/* !usr/share/man/man*

If you are a KDE user or if you just use any KDE application you also need to add !usr/share/locale/all_languages !usr/share/locale/currency/*> to that line, so we don’t break kdelibs.

While KDE Frameworks 5 users, should add !usr/share/locale/kf5_all_languages to don’t break KF5 apps.

Here we are, localepurge made KISS!

UPDATE 2: Since 2nd Oct ‘14, KDE 4 installations are installed under /usr/share/locale/kde4/, then KDE 4 users also need to add usr/share/locale/kde4/* !usr/share/locale/kde4/en* !usr/share/locale/kde4/all_languages !usr/share/locale/kde4/currency/*.

Tags: arch linux, linux, howto

By Andrea Scarpino on 2013-12-29

Discuss on HackerNews