Monday, June 3, 2013

Prevent custom Debian packages from being upgraded (except by your own “flavour”)

The use case is a QEMU build with GlusterFS native integration.

You’ve created your custom debs.

You don’t want your packages to be replaced by the official Debian ones (which lack the desired feature) the next time you do an apt-get upgrade.

So.

Adopt a customized deb revision name/number such as -2+glusterfs

More explicitely, on top of debian/changelog you write something like:

qemu (1.5.0+dfsg-2+glusterfs) testing; urgency=low
Build and install your package (I assume you know how to do that already).

The magic is done by APT Pinning.

Put this in your /etc/apt/preferences (or create a specific fragment in /etc/apt/preferences.d/)

  Package: qemu*
  Pin: version *-*+glusterfs
  Pin-Priority: 1001

So, in case you create your own repo, only QEMU-related packages whose revision number ends in +glusterfs (i.e.your own “flavour”) will automatically replace your installed ones.

Which is visibly far more flexible then using aptitude hold and friends.

Monday, August 6, 2012

dh_make under debian wheezy (testing)

use --copyright, because -c doesn’t work.

Friday, July 20, 2012

Debian preseed / Simple-CDD : avoid first keyboard layout question

In profiles/MYPROFILE.conf put:

KERNEL_PARAMS="$KERNEL_PARAMS bootkbd=it"
I actually use:
KERNEL_PARAMS="$KERNEL_PARAMS bootkbd=it DEBONF_DEBUG=7 auto=true"

Wednesday, October 26, 2011

Python: How to “kill” an hanging HTTPConnection object

This may typically happen when you have an httplib.HTTPConnection object which is performing getresponse() in another thread and is, well, waiting...

Suppose you have the urgent need to terminate it. You don’t have a terminate() method. What you need is the sock attribute (undocumented), which gives you access to the corresponding socket.Socket object. On this object you can call shutdown().

So you go:

myHTTPConnection.sock.shutdown(socket.SHUT_RDWR)

as in this (production) example:

https://github.com/gderosa/xbmc-vera/blob/a61e05964eee3b2a1536ccf19b7916a3bacebd3b/resources/lib/gui/main.py#L54.

Wednesday, August 10, 2011

WTF: UTF8 encoding with Ruby Sequel (and MySQL)

http://blog.codefront.net/2008/03/15/utf8-encoding-with-ruby-sequel-and-mysql/

Friday, June 17, 2011

Debian “alternative” for Ruby 1.9.1 (1.9.2, actually ;-)

So you don’t have to create symbolic links manually and they get managed after any further installation of Ruby-related Debian packages.

Sunday, April 17, 2011

OpenVPN on Sony Ericsson Xperia X10 Mini Pro (Android 2.1 Eclair)

The following procedure will kill your dog and void your warranty. Keep reading at your own risk, blah blah blah...

Spent the whole Sunday on this. I did not take a note of every step, so I hope my /dev/brain will not fail ;-P

First, this phone has got wonderful hardware in a small size. But Sony-Ericsson is having an horrible policy on software updates. The device came with Android 1.6 (very old). It's been upgraded to 2.1, and that's it. No Froyo nor Gingerbread available.

I'm on 2.1 and was confused by a lot of HOWTOs referring to 1.6, so be careful on this.

You will need Windows (or Mac OSX, maybe) 'cause there's no ADB driver for Linux.

(A VirtualBox Windows guest inside your Linux box WILL NOT WORK, even with USB device properly redirected).

You will need root access, on that purpose I used the (modified) SuperOneClik which is found here:

http://forum.xda-developers.com/showthread.php?t=906742

You also need the TUN/TAP kernel module. There's a binary download at:

http://code.google.com/p/get-a-robot-vpnc/downloads/detail?name=tun.ko

You need BusyBox (which provides standard ifconfig and route commands): search on the Market...

Now it's time to make the OpenVPN Installer happy.  And it's time to use the shell. You can use the adb.exe provided by SuperOneClick. Open a Command Prompt and cd into the SuperOneClick directory, then:

adb shell
su
mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
mkdir /system/xbin/bb
cd /system/xbin/bb
ln -s ../ifconfig ifconfig
ln -s ../route route
ln -s ../ip ip 

I'm not sure the last command is necessary, it won't be evil anyhow. Maybe this whole thing is already done, depending on which BusyBox packaged distribution you installed. So use your common sense.

Now grab the OpenVPN installer here (no longer available on the Market, apparently):

http://www.androidzoom.com/android_applications/communication/openvpn-installer_epia_download.html

It will ask in which path you want to install the OpenVPN binary: choose /system/xbin.

It will ask in which path OpenVPN should find ifconfig and route: choose /system/xbin/bb. (For some strange reasons it WILL NOT work with /system/xbin even if ifconfig and route are correctly there, and that's why you had the need to create the symlinks above).

Now, there's a strongly suggested location to keep the OpenVPN config files and certificates: it's /sdcard/openvpn . In other words, in the openvpn directory just in your microSD card. That's where the OpenVPN Settings app will expect to find your config files and certs.

Yes, you need to install yet another application: the OpenVPN Settings app is easily found on the Market, and will simplify the procedure of starting and stopping the OpenVPN daemon (and loading the tun.ko kernel module).

Of course, feel free to manage the openvpn daemon within the (adb rooted) shell, especially for debugging purposes.

That should be all.