Category : Nerd Stuff

Rpmrebuild FTW!

A problem that I faced today, summarized in a tweet:

After some Googling, I found this blog post about a tool called rpmrebuild.

I decided to give it a go on the Oracle-supplied RPM for JDK6. It is called jdk-6u45-linux-amd64.rpm in the current directory.

$ rpmrebuild -n --change-spec-preamble='sed -e "s/^Name:.*/Name:jdk6/"' -p jdk-6u45-linux-amd64.rpm
result: /home/martijn/rpmbuild/RPMS/x86_64/jdk6-1.6.0_45-fcs.x86_64.rpm

Comparison of the original and resulting RPMs showed the following:

  • file size of the original RPM is 57MB, the result is 50MB
  • Reported Size in the output of rpm -qpi only differs 60kB
  • Name, Build Date, Build Host and Size are the only meta-information fields that changed
  • The file list of both RPMs (output of rpm -qpl) is exactly the same

This looks good, so let’s try installation:

$ sudo rpm -ivh jdk6-1.6.0_45-fcs.x86_64.rpm                                                          [0]
Preparing...                ########################################### [100%]
        file /etc/.java/.systemPrefs/.system.lock from install of jdk6-2000:1.6.0_45-fcs.x86_64 conflicts with file from package jdk-2000:1.7.0_21-fcs.x86_64
        file /etc/.java/.systemPrefs/.systemRootModFile from install of jdk6-2000:1.6.0_45-fcs.x86_64 conflicts with file from package jdk-2000:1.7.0_21-fcs.x86_64
        file /etc/init.d/jexec from install of jdk6-2000:1.6.0_45-fcs.x86_64 conflicts with file from package jdk-2000:1.7.0_21-fcs.x86_64

These file conflicts were to be expected, since the installed JDK7 also ships them. So we need more trickery, in the form of a –change-files option to rpmrebuild.

export RPMREBUILD_TMPDIR=`mktemp -d`
rpmrebuild -n \\
  --change-files="sed -i '/^%config.*\"\\/etc/d' $RPMREBUILD_TMPDIR/work/files.1" \\
  --change-spec-preamble='sed -e "s/^Name:.*/Name:jdk6/"' \\
  -p jdk-6u45-linux-amd64.rpm

$RPMREBUILD_TMPDIR/work/files.1 is the file that lists all the files to be included in the RPM. Using sed -i, we remove all the lines from that file that name a configuration file under /etc, represented by the regular expression /^%config.*\"\/etc/.

The resulting RPM seems to install nicely on a RHEL6 system that already has a Java7 SDK installed. Win! Of course, for the sake of consistency, I need to do the same thing to the Java7 RPM. Unfortunately, the Java7 RPM had one more problem, being that the postinstall scriptlet would give errors, due to the files we deleted now being missing. My final invocation for the Java7 RPM is as follows:

export RPMREBUILD_TMPDIR=`mktemp -d`
rpmrebuild -n \\
  --change-spec-preamble='sed -e "s/^Name:.*/Name:jdk7/"' \\
  --change-files="\\
    sed -i '/^%config.*\\"\\/etc/d' $RPMREBUILD_TMPDIR/work/files.1; \\
    sed -i 's/\\/etc\\/init.d\\/jexec start/#\\/etc\\/init.d\\/jexec start/' $RPMREBUILD_TMPDIR/work/post.1; \\
    sed -i 's/\\/usr\\/lib\\/lsb\\/install_initd jexec/true; #\\/usr\\/lib\\/lsb\\/install_initd jexec/' $RPMREBUILD_TMPDIR/work/post.1; \\
    sed -i 's/\\/sbin\\/chkconfig --add/true; #\\/sbin\\/chkconfig --add/' $RPMREBUILD_TMPDIR/work/post.1" \\
  -p jdk-7u21-linux-x64.rpm

YouTube naar XBMC

Sinds de komst van XBMC op mijn Raspberry Pi heb ik ook een paar appjes op mijn Android telefoon geprobeerd, om XBMC mee te kunnen besturen. Een van de leukste features van die apps is eigenlijk dat je een filmpje op YouTube met een druk op de knop af kunt laten spelen op XBMC op een andere computer.

Deze functionaliteit wilde ik ook op mijn laptop, want ik zit vaker met de laptop op de bank te surfen dan met m’n mobiele telefoon. Wat zoekwerk leverde wel wat dingetjes op, namelijk in de vorm van een Firefox-extensie en een bookmarklet, maar beide werkten niet naar behoren.

Het idee van een bookmarklet sprak me wel aan, dus ben ik zelf aan het stoeien gegaan. Hieronder vind je het resultaat.

XMBC (we hebben het over versie 12, a.k.a. ‘Frodo’) heeft een JSON-RPC API, die het mogelijk maakt om de applicatie van buitenaf te besturen. Via Settings -> Services -> Remote control -> Allow programs on other systems to control XMBC kun je deze API inschakelen. Daarnaast moet de YouTube video add-on geinstalleerd zijn.

De code

javascript:(function(){var%20h='raspi';var%20v=document.URL.match(/v=([^&]+)/);if(v){var%20vid=v[1];var%20url='plugin://plugin.video.youtube/?path=/root/video&action=play_video&videoid='+vid;var%20request=JSON.stringify({jsonrpc:%20"2.0",method:"Player.Open",params:{item:{file:url}},id:1});var%20url='http://'+h+'/jsonrpc?request='+escape(request);var%20w=window.open(url);}else{alert('No%20video%20ID%20found');};})();

Gebruiken is simpel. Maak een nieuwe bookmark in je browser, en op de plaats van de URL voer je de bovenstaande code in. Vervang daarin de hostname van mijn XMBC computer (de waarde ‘raspi’ in de variable ‘h’ aan het begin van de code) door de hostname of het IP-adres van jouw XBMC.

Surf vervolgens lekker rond op YouTube, en als je een filmpje ziet waarvan je vindt dat iedereen het moet zien, klik dan op de net aangemaakte bookmark. Als het goed is, begint XBMC direct met het afpelen van de video. Getest en werkend bevonden in Firefox en Chrome.

Introducing “Taggert”, a GTK+3 geotagging application

Up to now, I have been geotagging my pictures with gpsPhoto.pl, a command-line tool, that matches coordinates from GPX files with the timestamps on images. This works nicely, but it requires that you indeed have a GPX track from the time the picture was taken. For some time, I have been looking for a tool that allows me to do manual geotagging using a map.

I have found several tools that offer this functionality, or part of it. As a matter of fact, there are quite a few tools available for Windows, but I need one that runs on Linux, so I will not discuss those here. First, I found Geotag, a Java application, but it does not offer a map, so it isn’t very convenient. What I was looking for should look a lot like locr GPS Photo for Windows. This is, as the name suggests, a Windows-only tool.

Finally, I found GottenGeography, a GTK+ tool, written in Python, that does almost everything I want. Almost.

When I found GottenGeography, I had already started to explore the possibilities of writing a tool of my own, and the basis for Taggert was already there. After playing around with GottenGeography for a while, I decided I don’t like some of its design choices, and because creating a GTK+ application in Python seemed like a nice challenge, I decided to continue. And here it is: Taggert v1.0.

The README on Github explains what Taggert is, what it aims to be and how to try it out.

In short: Taggert allows add, change and remove geotags on your pictures, either manually using a marker on a map, or automatically using one of more GPX files containing GPS tracks. It allows you to store bookmarks for frequently-used locations and it supports multiple map sources, like OpenStreetMap and MapQuest.

In the near future, I hope to provide packages for different Linux distributions (at least Debian and Ubuntu). For now, you can download it from Github.

Octocopter bij Lowlands-camping

Afgelopen zaterdag zagen we op Lowlands camping 1 ineens een UFO boven de camping vliegen. Nader onderzoek wees uit, dat het om een octocopter ging:

Op de octocopter staat de URL tfcm.nl, wat blijkt te staan voor The Flying Camera Men. Ik heb ze een mail gestuurd met de vraag of de beelden die ze op Lowlands hebben geschoten ergens te zien zijn. Ben benieuwd…

1 2 3 4 5 6 13