Zum Hauptinhalt springen
Chris’ wirre Gedankenwelt
  1. Tags/

Configuration

Monkey patch a puppet provider

I just wanted to monkey patch the puppet package provider for gentoo portage.

But why?

# puppet resource package

Only shows packages installed by puppet, but not packages installed by hand. The apt/dpkg- and yum/rpm-provider list all packages.

It was not enough to place a lib/puppet/provider/package/portage.rb. In all my tests, the original behavior was kept. I only want to replace one function.

But how?

When registering new type or providers, etc, puppet is doing a bunch of magick in the background. So first, I have to figure out the name of the automagically created class.

polkit-Regel um Usern poweroff zu erlauben

Auf meinem Arch Linux mpd-Server wollte ich dem User mpd erlauben den Rechner herunter zu fahren. Die einfachste Variante ist es, den Benutzer mpd einfach zur Gruppe wheel hinzuzufügen. Diese wird auch in polkit als Admingruppe anerkannt. Nun wollte ich mpd aber nur erlauben herunter zu fahren und nicht gleich Zugriff auf alle Adminfunktionalität zu geben.

Dazu muss eine Datei /etc/polkit-1/rules.d/mpd.rules angelegt werden:

polkit.addRule(function(action, subject) {

    if (action.id == 'org.freedesktop.login1.power-off' &&
        subject.isInGroup('mpd')
    ) {
        return polkit.Result.YES;
    }
});

Ich habe hiermit gleich der Gruppe mpd Berechtigungen zum poweroff gegeben. Mit subject.user == 'mpd', hätte dies auf nur den einen Benutzer begrenzt werden können.

… mit xmodmap

Mac OS X iTerm2, tmux and jump word

Currently I'm working on a MacBook. Not entirely by choice, however.

I'm trying to use my almost used environment, including tmux. As Terminal replacement I'm using iTerm2, since it seems to be faster. Unfortunately I was not able to use ALT-[left|right] to jump words backward and forward. The only thing I had to do to solve this... capturing the sequences of ALT-left and ALT-right and place them into ~/.inputrc

# Press ALT-left

$ read
^[^[[D
# and ALT-right
$ read
^[^[[C
$ vi ~/.inputrc
"\e\e[D": backward-word
"\e\e[C": forward-word

And open an new instance of iTerm2.