Build Ubuntu/Debian packages from source (and apply a patch)

Sometimes there is a bug in a package from ubuntu that is not yet fixed, or you just want to modify something in the source of a software. Here is an easy way to build your own package from the ubuntu sources.

First you need to install the required tools for building software from source

sudo apt-get install build-essential

Let's assume you want to build a package called foo and apply a patch bar.patch to it.

First you have to download the necessary build dependencies for foo

sudo apt-get build-dep foo

Now you are ready to download the actual sources of the package (Don't use sudo here!!)

apt-get source foo

This gives you a directory called foo-<version> you can now cd into it apply the patch and build the package

cd foo-<version>
patch -p1 < bar.patch
dpkg-buildpackage

Now you have a package called foo-<version>.deb in the same directory where you have run apt-get source. You can install it using dpkg.

sudo dpkg -i foo-<version>.deb

Automatically start SCREEN on SSH login

I just found a nice methode to invoke screen automatically if after login via SSH. So you don't have to manually start it first.

Put the following at the and of your ~/.bashrc

# Auto-screen invocation. see: http://taint.org/wk/RemoteLoginAutoScreen
# if we're coming from a remote SSH connection, in an interactive session
# then automatically put us into a screen(1) session.   Only try once
# -- if $STARTED_SCREEN is set, don't try it again, to avoid looping
# if screen fails for some reason.
if [ "$PS1" != "" -a "${STARTED_SCREEN:-x}" = x -a "${SSH_TTY:-x}" != x ]
then
  STARTED_SCREEN=1 ; export STARTED_SCREEN
  [ -d $HOME/lib/screen-logs ] || mkdir -p $HOME/lib/screen-logs
  sleep 1
  screen -RR &amp;&amp; exit 0
  # normally, execution of this rc script ends here...
  echo "Screen failed! continuing with normal bash startup"
fi
# [end of auto-screen snippet]

If you want more details and some aditional tricks just go to http://taint.org/wk/RemoteLoginAutoScreen.

Bazaar Pro Engineer Helper 0.3.0 Released

Yesterday I released Bazaar Pro Engineer Helpers 0.3.0 it supports recognizes more file types and does some more cleaning if you use the --purge option.

You can download it on Launchpad or directly form my site.

Installation instructions can be found here.

Additionally is now listed at Softpedia.

Wuala rc.d Script for Archlinux

Recently I published an init.d script for debian/ubuntu to start wuala in headless mode. Since some time now I have a mediacenter running on Archlinux so the debian init.d script needed some change to run properly. I'm currently putting together a package to install wuala on archlinux with via pacman. In the meantime I will publish the rc.d script  in case someone wants to install wuala manually following the instructions found here.

/etc/rc.d/wuala (download)

!/bin/bash
 
WUALADIR=/home/wuala/wuala
WUALAUSR=wuala
BACKPWD=`pwd`
USECOLOR="YES"
. /etc/rc.d/functions
 
case "$1" in
        start)
                rc=0
                stat_busy "Starting Wuala"
                cd $WUALADIR
                su $WUALAUSR -c "screen -d -m $WUALADIR/wualacmd"
 
                add_daemon wuala
                stat_done
 
        ;;
        stop)
                rc=0
                stat_busy "Stopping Wuala"
                cd $WUALADIR
                su $WUALAUSR -c "$WUALADIR/wualacmd exit > /dev/null"
 
                rm_daemon wuala
                stat_done
        ;;
        restart)
                $0 stop
                sleep 1
                $0 start
        ;;
        status)
                cd $WUALADIR
                su $WUALAUSR -c "$WUALADIR/wualacmd showStatus"
        ;;
        *)
                echo "usage: $0 {start|stop|restart|status}"
esac
 
cd $BACKPWD
 
exit 0

Upadte: Use wualacmd instead of wuala. (Thanks to http://www.synergeek.fr/2010/06/wuala-sous-linux/ for the hint)

HP Printer drivers (hpijs) for Mac OS X

Since I switched to Snow Leopard I was not satisfied with the printing drivers for my old HP OfficeJet 95. I used the includet Gutenprint drivers. For text they worked ok, but images looked terrible.

Today I decided to do something about it. From Linux I know that HPLIP has some pretty good driver (hpijs) for most HP Devices. Fortunately I can use the same drivers for Mac OS X to. You need three packages to do this. More information can be found on the website of the Linux Foundation.

http://www.linuxfoundation.org/collaborate/workgroups/openprinting/macosx/hpijs

This should help you get your old HP Printer working.

How to enable ALSA Analog 5.1 Sound on Nvidia ION

I recently had the problem to enable 5.1 Sound with 3 click outputs on an Nvidia ION board. By default Linux configures it with only one plug configured as output. After some research I found a solution in the OpenSUSE Wiki you have to set during module loading to get it working.
Basically you have to add

options snd-hda-intel model=3stack-6ch enable=1 index=0

to your modeprobe.conf to tell the driver to use all its 3 plugs as output. After you loaded the modules like this, alsamixer will show you all the 6 channels, so you can unmute them.

Wuala init.d Script for Debian/Ubuntu

I recently wanted to install Wuala on my brand new media center PC running Ubuntu on it. It was not that hard because there is an excellent tutorial on how to setup wuala on a headless machine.

Unfortunately there was no script to start and stop Wuala on system start-up and shutdown. So I decided to create one.

/etc/init.d/wuala (download)

#!/bin/bash
 
### BEGIN INIT INFO
# Provides:          wuala
# Required-Start:    $network $local_fs $remote_fs
# Required-Stop:     $network $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: start Wuala headless (wuala)
### END INIT INFO
 
WUALADIR=/home/wuala/wuala
WUALAUSR=wuala
BACKPWD=`pwd`
 
case "${1:-''}" in
  'start')
        # start commands here
        echo "Starting Wuala..."
        cd $WUALADIR
        su $WUALAUSR -c "screen -d -m $WUALADIR/wualacmd"
    ;;
 
  'stop')
        # stop commands here
        echo "Stopping Wuala..."
        cd $WUALADIR
        su $WUALAUSR -c "$WUALADIR/wualacmd exit"
    ;;
 
  'restart')
        # restart commands here
        $SELF stop
        sleep 1
        $SELF start
    ;;
 
  'status')
        # status commands here
        cd $WUALADIR
        su $WUALAUSR -c "$WUALADIR/wualacmd showStatus"
    ;;
 
  *)
        # no parameter specified
        echo "Usage: $SELF start|stop|restart|status"
        exit 1
    ;;
esac
 
cd $BACKPWD

It is a very early version with not much error checking, so use it at your own risk. I just posted it in case somebody might find it useful.

To use it just save the content to /etc/init.d/wuala and run

$ sudo update-rc.d wuala defaults

Update: Added the necessary LSB informations
Update 2: The file can now be downloaded: /etc/init.d/wuala.
Upadte 3: Use wualacmd instead of wuala. (Thanks to
http://www.synergeek.fr/2010/06/wuala-sous-linux/ for the hint)

Activate VT Virtalization support on a Sony Vaio VGN-Z11WN

Update: Sony released a new version of their BIOS which allows the activation via menu.

I found a nice tutorial how to enable the Support for Intel VT on a Sony Vaio, with Firmware.
Just follow the tutorial on this site.

Database migration using SQLAlchemy

Recently I found a script to migrate between SQLite and PostgreSQL on Lazy Crazy Coder's blog. It's pretty cool, especially as it shows the flexibility of SQLAlchemy in this case used as a middleware.

You can download the script here.

VLC takes very long to start!?

I recently had the problem that my VLC Media Player took about a minute to start. First I didn't know what caused the problem until I remembered that I imported my Music Library into VLC, so it always scanned the whole Library to import the meta data.

To disable the Media Library do as follows:

  1. Open: Tools -> Preferences
  2. Under Show Setting select "All" to show all settings
  3. Go to: Playlist
  4. Uncheck "Use Media Library"
  5. Click "Save" to finish

Now your VLC should start up quickly again.