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

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