Unmask packages in Gentoo

Let’s take a little break in the political ranting and go geeky. I’m using Gentoo Linux (Gentoo GNU/Linux for you FSF nutbags) and I tend to run some software marked unstable. To do this you have to unmask the packages you want to install. For some reason I could not get the autounmask package to work properly (It kept unmasking one package over and over again) and I got sick of manually entering each needed package into the unmask file.
Having too much time on my hands, I wrote a bash script that unmasks a package and all its dependencies. You call the script as:

./unmasker.sh =app-category/app-version

For example, to unmask kde 4.1.2 you run:

./unmasker.sh =kde-base/kdebase-meta-4.1.2

I’ve successully unmasked portage 2.2_rc12, Gnome 2.24.0 and KDE 4.1.2 with this script.

This script will not handle blocked packages or EAPI incompabilities. For examle with KDE 4.1.2 I had to unmask and install portage 2.2_rc12 first due to the ebuild requirering a portage with EAPI-2 support, and I also manually had to uninstall qt-4.3 since it was blocking qt-4.4.

Anyhew, give it a go if you want to try it out, and you’re welcome to give me suggestions on how to improve it.

Get script here


6 Responses to Unmask packages in Gentoo

  1. Durand says:

    Thanks, your script works well!

  2. Alex says:

    Great script!

    One issue – your script is unmasking the newest version of a package, sure it useful (but you do not really need to put exact version in the output file for it, btw;).
    But sometimes, especially when someone wants “just to try something masked”, it actually needed to unmask the lowest package’s version available in order to minimize system rebuild… This can be easily done by changing ‘head -n 1’ to ‘tail -n 1’ at line 34.

    So, it might be useful to add a key (or something else) to have a choice of script’s logic.


  3. ds3k says:


    Thanks for the tip. I’m not running Gentoo anymore but maybe I’ll update the script eventually.

  4. Mickael says:

    It does not work for “x11-libs/qt-4.5.2”
    when i type : “./unmasker.sh =x11-libs/qt-4.5.2”
    i get :

    — Invalid atom in /etc/portage/package.keywords: =
    Unmasking packages, this might take a while… — Invalid atom in /etc/portage/package.keywords: = — Invalid atom in /etc/portage/package.keywords: =

    If i type :
    ./unmasker.sh x11-libs/qt-4.5.2 # withotu the ‘=’
    i get :

    Creating necessary directories and files…
    !!! ‘x11-libs/qt-4.5.2’ is not a valid package atom.
    !!! Please check ebuild(5) for full details.
    Unmasking packages, this might take a while…

    Then in loop :
    !!! ‘x11-libs/qt-4.5.2’ is not a valid package atom.
    !!! Please check ebuild(5) for full details.
    — Invalid atom in /etc/portage/package.keywords: =

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: