Set up your own Transifex server in virtualenv

So lately I was in need of some good web based translation software. I knew transifex is open source and therefore I went poking around their site - but not much open source info is up on their site.
I tried the -git version without success and therefore went with the stable 1.2.1 version[1].
First set up the enviroment and code: # virtualenv tx # cd tx/ # source bin/activate # wget https://github.com/downloads/transifex/transifex/transifex-1.2.1.tar.gz # tar xzvf transifex-1.2.1.tar.gz # mv indifex-* transifex/ Second install all the needed dependencies (with the help of modified/completed requirements.txt[2]): # wget http://txt.si/files/transifex-1.2.1/requirements.txt # pip install -r requirements.txt Third patch, set up and configure Transifex server:
Because of deprecated setting in transifex/settings/40-apps.conf you need to swap SCRATCH_DIR value with os.path.join(PROJECT_PATH, 'scratchdir') # cd transifex/ # ./manage.py txcreatedirs # ./manage.py syncdb # ./manage.py migrate # ./manage.py txlanguages # ./manage.py txcreatenoticetypes # ./manage.py collectstatic There it is. Now you can use the built in django's runserver to access your site or set it up the same way you do with any other django app.
Note: uploading with transifex-client is not working because of some permission problems (it _should_ be fixed, but it isn't) that I'm yet to track down.

[1] - https://github.com/transifex/transifex/downloads
[2] - http://txt.si/files/transifex-1.2.1/requirements.txt

Play League of Legends on 64bit Archlinux with xf86-video-ati

Getting League Of Legends working on a 64bit Archlinux installation with ati open source drivers (xf86-video-ati) is actually quite straightforward once you know what to install (presuming you already have multilib system) :).
First, you need to have your open source ati graphic drivers set up correctly. This is out of scope, but well documented on Archlinux Wiki[1].
Second, you need to install some 32bit libraries:
  • lib32-ati-dri - from Multilib
  • lib32-gnutls - from Multilib
  • playonlinux - from Community
  • lib32-libtxc_dxtn - from AUR[2]
You can check if everything works by installing lib32-mesa-demos from Multilib and running: # glxinfo32 | grep direct # glxinfo32 | grep GL_EXT_texture_compression_s3tc Third, open Play On Linux, find League of Legends in Install (note: check the Testing checkbox) and follow the on-screen instructions.

P.S: If Play On Linux says it can't find OpenGL libraries (after you installed lib32-ati-dri) and you had an old ATI graphics driver stack installation, check if /etc/profile.d/radeon.sh exsists and delete it.

Big thanks to lordheavy and pango on #playonlinux for all the help/assistance.

[1] - https://wiki.archlinux.org/index.php/ATI
[2] - http://aur.archlinux.org/packages.php?ID=40343

Rescue and update an old RTD1073 based media player

Quite some years ago I purchased a simple chinese Realtek RTD1073 based player. That's the same as the first generation Xtreamer, Asus O!Play and many others. The chipset was quite popular because it was cheap and offers quite a lot at least on paper. A vibrant community quickly formed around the chipset/players but it was unfortunately quite severly crippled by the GPL violations, lack of documentation and a big binary DvdPlayer application that is responsible for almost everything - from IR recieving to actual GUI display. I used it a bit but the interface was horrible and performance lacking. I shelved it and it was collecting dust for 2 years. But recently I decided to clean it up and update it, ensuing a lot of fun. The documentation about the devices is scattered far and beyond the internet. I tried to collect some of it in a wiki[1].
First I tried to update it to the latest image that the company I bought it from is providing. That didn't go that well as it seems that they changed the remote and mine was not working anymore. That's quite easy to fix - simply telnet to your device and force an upgrade with: # echo "http://my-home-server/install.img" > /tmp/installing_source # kill -6 1 This forces the system to reflash itself with the new install.img. When that was complete (beware - it can take up to 20min) I decided to update it to a latest PBO GUI2.0[2] that looks quite good.
This FW requires a new bootcode (the lower level parts of the system) which update was believed to be only doable over a serial connection. I found an excellent resource in moServices[3] where they provide an install.img that updates the bootcode to the latest known version 23[4] (use the file for R1/R3). Unfortunately that updates the whole system too with a (seemingly) stock Asus O!Play one that has hardware checks and refuses to work on non Asus O!Play hardware. This renders the device unusable with DvdPlayer restarting itself over and over again. The device also doesen't request an IP via DHCP and therefore seems stuck. But fortunately it does set an default IP 192.168.0.9. I connected the device directly to my computer, set the computer IP to 192.168.0.10, telneted to 192.168.0.9 and restored the system as shown before.
But this time I used another moServices goodie caled AMP r8[5] with pohd skin[2] (I replaced the install.img on the server with the downloaded one). That flashed the new FW - with removed hardware checks and a good looking GUI.
Almost done. I just had to get the remote working. Fortunately AMP r8 comes with irfake installed and a great tutorial on how to configure it[6]. And that's it, now my cheap chinese media player boots with Asus logo and A.C.Ryan branded interface - but hey, it works (albeit a bit shabby on some content - most notably 1080p problems and audio)! :D
Thanks to all the people that made this possible!

[1] - http://w.p2p.si
[2] - http://www.acryan.com/forums/viewtopic.php?f=152&t=10077
[3] - http://moservices.org/
[4] - http://moservices.org/forum/viewtopic.php?f=12&t=98
[5] - http://www.moservices.org/forum/viewtopic.php?f=12&t=1030&sid=6c51ece999c6acc57b922e4c13b305ca
[6] - http://www.moservices.org/forum/viewtopic.php?f=12&t=179

TIP: Subversion over Samba (SMB) mounts

So, I recently had to mount a Samba share and do a Subversion update on that share. It has been proven quite... challenging. Yes, I know it's a broken concept, but it's something I have to work with for now.
So, for Subversion to work with SMB, you have to mount the share with "nobrl"[1] option. This can be dangerous they say, so I recommend that you read the docs[1].
Sample:
//<host>/<share> </path/to/mountpoint> cifs nobrl,rw,nounix,user=<username>,password=<password>,uid=1000,gid=1000 0 0 Thanks to Neil Bird for the tip[2].

[1] - http://www.samba.org/samba/docs/man/manpages-3/mount.cifs.8.html
[2] - http://mail-archives.apache.org/mod_mbox/subversion-users/201111.mbox/%3C4EAFF02E.10000@jibbyjobby.co.uk%3E

Minimal (<10MB) base Linux/Gentoo system

For a school assigment I had to do, I chosed the creation of a minimal linux live cd that boots up to some sort of a shell. I also got bonus points if I can get it under 10MB.
As a longtime Gentoo user I created a chroot and first tried trimming the standard base system down. But as I soon found out, that won't work, at least not to the extend I wished to. And then I found the Tiny Gentoo[1] wiki page describing an alternative option.
Unfortunately the TinyGentoo wiki page is a bit of a mess and sometimes outdated. (I'm still thinking if I should clean it up or create a separate wiki page based on my work.) Because of that I encountered quite some bugs/problems and solved/hacked together a solution for most of them.
So basicly, what do you _really_ need for a Linux system to boot up. Ofcourse, you need the Linux kernel and a bootloader (Grub2 was my choice). For the next stage, you need a C library and a Shell with some standard commands/utilities. I chose those two from a standard embedded setup, namely uClibc and BusyBox. Next thing you need is some kind of a init system. BusyBox has it built in, but I chosed to go with OpenRC/baselayout. Now that we know all the "components" we will need, let's try to compile and glue everything together.
As previously stated, this guide is heavly based on TinyGentoo and work of judepereira. It is also recommended that you have previous experiance with Gentoo and Gentoo installed on your workstation, but it is not a requirement.
In the process of writing this, it came to my attention that someone has recently done a similar tutorial: http://www.anticore.org/ratgentoo/

Teh guide

First, you need to create a working directory, you don't need too much space - a few GB should be enough. Let's call this directory $MINI_ROOT.
Download the latest x86 uClibc stages from judepereira's blog[2] and extract it to $MINI_ROOT.
Now we need to do some standard chores before we can chroot:
  1. "cp -L /etc/resolv.conf $MINI_ROOT/etc/resolv.conf" - for internet connectivity
  2. "mkdir -p $MINI_ROOT/usr/portage"
  3. Now if you have Gentoo installed on your workstation:
    1. "mount --bind /usr/portage $MINI_ROOT/usr/portage" - to avoid downloading the distfiles
    Else:
    1. From the closest Gentoo mirror download the lasted portage snapshot
    2. Extract it in $MINI_ROOT/usr/portage
  4. "mount --bind /dev $MINI_ROOT/dev"
  5. "mount -t proc proc $MINI_ROOT/proc"
Now before we're ready to chroot, there are some files you'll need later in that chroot, and I advise you copy them there beforehand. Download the package[3] that contains the portage files, patched uclibc ebuild, inittab and init script. Extract the archive to $MINI_ROOT and this will copy the appropriate files. Now it's time to chroot:
  1. "chroot $MINI_ROOT /bin/bash"
  2. "env-update"
  3. "source /etc/profile"
And voila, you're in your uClibc chroot. First we need to update the system:
  1. "ln -snf /usr/portage/profiles/uclibc/x86 /etc/make.profile" - symlink the appropriate profile
  2. "emerge -uDNav world" - we carefully update world. Please READ all the messages portage gives you and act accordingly.
So, our chroot is up to date and almost ready to rumble. First we need to install some additional packages we will need - "emerge -av cdrtools grub cpio".
Now we are ready to preapare our root FS. Create a directory inside your chroot where the root FS will reside. Let's call this directory $TARGET_ROOT. You also need to create "$TARGET_ROOT/proc" and "$TARGET_ROOT/sys".
Now it's time to install the packages.
"ROOT=$TARGET_ROOT USE=make-symlinks emerge -avkN baselayout uclibc busybox openrc mingetty" - this can take some time. Make sure the patched uclibc gets pulled in [insert patch notes here].
When portage finishes, you have to do some minor corrections:
  1. "cp /usr/lib/gcc/i386-gentoo-linux-uclibc/4.5.3/libgcc_s.so.1 $TARGET_ROOT/usr/lib/" - because even with static cimpiling, openrc doesen't compile fully staticly.
  2. "cp /misc/inittab $TARGET_ROOT/etc/" - copy the modified inittab
  3. "cp /misc/init $TARGET_ROOT/" - copy the init script
  4. edit "/etc/fstab", by default nothing in there is needed
This now allows us to to chroot into our target with "chroot $TARGET_ROOT /bin/ash". After that we have to do some elementary maintainance that can be skipped if needed:
  1. "adduser -h / -s /bin/ash -G users USERNAME"
  2. "rc-update del netmount default"
  3. "rc-update del net.lo boot"
  4. "rc-update del sysctl boot"
We exit the chroot and start preparing for iso making:
  1. "mkdir -p /tmp/iso/grub/" - create the directory structure
  2. "cp /boot/grub/stage2_eltorito /tmp/iso/grub/" - copy grub stage 2
  3. Create menu.lst in the grub directory, there is a sample in /misc/
  4. "cp -r $TARGET_ROOT /tmp/$TARGET_ROOT" - copy the target root for additional cleaning
  5. "rm -r /tmp/$TARGET_ROOT/var/*/* /tmp/$TARGET_ROOT/tmp/*" - more aggresive cleaning
  6. "cd /tmp/$TARGET_ROOT && find . | cpio -H newc -o | gzip -9 > /tmp/iso/initramfs-tinygentoo.igz && cd .." - Create initramfs
Now we need to compile the linux kernel, nothing exotic:
  1. "emerge -av gentoo-sources"
  2. "cd /usr/src/linux"
  3. "make menuconfig" - the only thing you really need is initramfs support
  4. "make"
  5. "cp arch/i368/boot/bzImage /tmp/iso/boot/vmlinuz"
  6. "make INSTALL_MOD_PATH=$TARGET_ROOT modules_install" - if you have any modules, you need to recreate initramfs after this.
Now finally, we can create the iso image: "cd /tmp/ && mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o cd.iso iso"

Some general tips:

  • "dispatch-conf $TARGET_ROOT" - update config files in $TARGET_ROOT
  • Use saved-config for tweaking (busybox/uclibc)

Notes about the custom ebuilds

There is a custom uClibc ebuild for version 0.9.30.1 that applies a simple patch that makes the uClibc compile. I would suggest that you first try to compile the latest stable and unstable uClibc ebuilds and resort to this ebuild (uclibc 0.9.30.1-r2).
Also, there are some sample configs for busybox and uclibc versions provided, because sometimes busybox doesen't compile and the easiest solution is to remove some parts of it. Note: this guide relies on the saved-config of busybox to compile with mdev support, the same could be achived with mdev use flag.

References

[1] http://en.gentoo-wiki.com/wiki/Tiny_Gentoo
[2] http://judepereira.com/blog/going-embedded-with-mgentoo/
[3] /files/tiny-gentoo.tar.gz
[4] http://jootmama.net/tg-install.htm
Next Page »