Isn’t it just beautiful – no. 2

Today I bought Slipknot‘s Antennas to hell via amazon mp3. I don’t like all the cloud bullshit, so I downloaded the files to my old fashioned mp3 player and found they have some ridiculous file naming pattern at amazon. But as usual … Linux (actually bash) could fix that easily.
Continue reading



I found it to be a pain in the ass to build xfce, so once I figured out a way to do that, I wrote a script that does it for me (on debian squeeze).

Before you start, wget the current version of all components from and put the files in one directory.

Then use this script:

apt-get install gcc gcc-multilib autoconf automake1.9 \ 
libtool flex bison gdb  gcc-4.4-multilib libmudflap0-4.4-dev \
gcc-4.4-locales libgcc1-dbg libgomp1-dbg libmudflap0-dbg \
libcloog-ppl0 libppl-c2 libppl7 automake make gnu-standards \ 
build-essential intltool python-gobject-dev libdbus-1-dev \ 
libdbus-glib-1-dev xorg-dev libx11-dev libgtk2.0-dev libglade2-dev \
libwnck-dev libgudev-1.0-dev libnotify-dev libgstreamer0.10-dev \
libghc6-gstreamer-dev libkeybinder-dev

export PREFIX=/usr/local/
export CFLAGS="-O2 -pipe"
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH"

cd src/xfce-4.8
mkdir done 2>/dev/null
for f in *bz2; do tar xjf $f; done
for component in garcon-*/ xfce4-dev-tools-*/ libxfce4util-*/ xfconf-*/ \ 
libxfce4ui-*/ libxfcegui4-*/ exo-*/ xfce4-panel-*/ xfce4-panel-*/ \
thunar-vfs-*/ xfce4-settings-*/ xfce4-session-*/ xfwm4-*/ xfdesktop-*/ \
xfce4-appfinder-*/ xfce-utils-*/ gtk-xfce-engine-*/ Thunar-*/ \
thunar-volman-*/ xfce4-power-manager-*/ tumbler-*/ ; do
  if ! cd $component; then
    echo "$component does not exist"
    if ls -ld done/$component; then
      echo "$component seems to be done already"
      echo "$component is missing"
      exit 1
  ./configure --prefix=${PREFIX} && make && make install
  if [ $? -ne 0 ]; then
    echo "compiling $component failed"
    exit 1
    cd ..
    mv $component done


Sorting “ip addr” output by device name

I got this small industrial computer thing that’s supposed to become a linux router / packet filter. It has 8 network interfaces, some 1 gigahertz CPU and a gig of RAM. Fanless design, rack mountable, data sitting on a CF card. Nice platform you might say.

While looking at the front I noticed an interface numbering that popped the word “weird” into my head, but I didn’t pay much attention due to the still going thrill of unpacking new hardware. The 4 fast ethernet were numbered 1-4 but from right to left. The 4 gigabit ethernet interfaces were numbere I-IV, also from right to left.

After installing linux and playing around a little bit, I started configuring it for what it’s supposed to do. One of the first things I needed to find out was: Which eth device corresponds to which port on the outside? Turns out eth0 is not the leftmost, but also not the rightmost port. Instead it’s the second port from the left.

I knew that the naming of ethernet devices was something in udev and that it remembers the mac addresses in order to uniquely identify each NIC. So I edited /etc/udev/rules.d/*net.rules and made a configuration where eth0 is the leftmost, eth7 the rightmost port. That way it would be most intuitive I figured. After a reboot, I saw this:

ip a|egrep "^[0-9]+"
1: lo:  mtu 16436 qdisc noqueue state UNKNOWN
2: eth4:  mtu 1500 qdisc noop state DOWN qlen 1000
3: eth5:  mtu 1500 qdisc noop state DOWN qlen 1000
4: eth0:  mtu 1500 qdisc noop state DOWN qlen 1000
5: eth6:  mtu 1500 qdisc noop state DOWN qlen 1000
6: eth7:  mtu 1500 qdisc noop state DOWN qlen 1000
7: eth1:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
8: eth2:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
9: eth3:  mtu 1500 qdisc noop state DOWN qlen 1000

Erm, yeah, you’ve got to be kidding me. Counting for dummies: 4,5,0,6,7,1,2,3.

I spent an hour trying to find a way to tell “ip” to sort its output by device name and guess what I found: nuthin.

So, the reason for me to open this blog boils down to one line of code that, after this experience, I felt like sharing.

function ip() {
  if echo $*|egrep -q \
  "^(a|addr)([[:space:]]*$|[[:space:]]+(s|show)[[:space:]]*$)"; then
    for dev in $(/sbin/ip addr show | \
    awk 'BEGIN{FS=":";}{if ($1 ~/^[0-9]+/){ print $2; } }'|sort)
      /sbin/ip addr show $dev
    /sbin/ip $*