if [ "$1" == "install" ] ; then
        mkdir .lighttpd
        cp /usr/local/lighttpd/lib/*.so .lighttpd/
        mv ./lighttpd.conf ./mod_fastcgi.so .lighttpd/

        mkdir .luaetta
        mv ./channel ./luaetta ./weblib .luaetta/
        echo "Installed";
        exit 0;
elif test -e ./.luaetta ; then
        /etc/init.d/lighttpd stop
        usleep 500
        killall lighttpd

        /usr/local/lighttpd/sbin/lighttpd -f `pwd`/.lighttpd/lighttpd.conf -m `pwd`/.lighttpd

        export LUAETTA_LISTENING_SOCKET=127.0.0.1:9999
        export LUA_PATH=`pwd`'/.luaetta/weblib/?.lua'
        killall luaetta
        usleep 500
        cd .luaetta
        ./luaetta > /dev/null &
        cd -
        echo "Launched";
        exit 0;
fi

echo "Not installed, or you are in the wrong directory";
echo "To install here: " $0 install
exit 1;

