diff --git a/config/app_config.yml.example b/config/app_config.yml.example
index 90d9ac9f4d8cafd5238a0cd37be20372e684cf7b..0bd3771f79c4d55448f9b9b4fe6336863d84ec08 100644
--- a/config/app_config.yml.example
+++ b/config/app_config.yml.example
@@ -7,7 +7,6 @@ default:
   debug: false
   socket_debug : false
   socket_host: 0.0.0.0
-  socket_pidfile: log/diaspora-wsd.pid
   socket_port: 8080
   socket_collection_name: 'websocket'
   pubsub_server: 'https://pubsubhubbub.appspot.com/'
diff --git a/pkg/fedora/README.md b/pkg/fedora/README.md
index 7c5c9e3a266a5af8a76605e123e855b8ade4ca34..e294302ce1a4a0818b4dce98fce5bed4d04a1028 100644
--- a/pkg/fedora/README.md
+++ b/pkg/fedora/README.md
@@ -12,11 +12,11 @@ aimed for packaging purposes.
 Prerequisites:
 
 - ruby-1.8, rubygem, git  and rake as described in
-  [RPM installation Fedora](http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora)
-  or [Installing-on-CentOS-Fedora](http://github.com/diaspora/diaspora/wiki/Installing-on-CentOS-Fedora)
+  http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora
+  or http://github.com/diaspora/diaspora/wiki/Installing-on-CentOS-Fedora
 
 - A personal environment to build RPM:s, also described in
-  [RPM installation Fedora](http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora)
+  http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora
 
 Install g++ (possibly unnnecessary?):
     % yum install gcc-c++
@@ -46,7 +46,7 @@ Start development server:
     cd /usr/share/diaspora/master
     ./script/server
 
-See [Using Apache](http://github.com/diaspora/diaspora/wiki/Using-apache) for
+See http://github.com/diaspora/diaspora/wiki/Using-apache for
 apache/passenger setup. After configuration, start with:
     /sbin/service diaspora-wsd start
     /sbin/service httpd restart
@@ -120,8 +120,7 @@ directory, copy-paste previous version nr. It will be updated.
 
 This has been confirmed to start up and provide basic functionality both using
 the thin webserver and apache passenger, on 32/64 bit systems and in the
-mock build environment. Irregular nightly builds are available form time to time
-at [ftp://mumin.dnsalias.net/pub/leamas/diaspora/builds](ftp://mumin.dnsalias.net/pub/leamas/diaspora/builds)
+mock build environment.
 
 #### Implementation
 
diff --git a/pkg/fedora/diaspora-setup b/pkg/fedora/diaspora-setup
index 01f0d3cdcbfd2b1690be1ae497533abfc1af59e3..0fa90dc9e4a9435601d14c4ef21681432edeb81f 100755
--- a/pkg/fedora/diaspora-setup
+++ b/pkg/fedora/diaspora-setup
@@ -24,8 +24,6 @@ cd /usr/share/diaspora/master
 
 test -e config/app_config.yml ||
     cp config/app_config.yml.example config/app_config.yml
-sed -i '/socket_pidfile:/s|:.*|: /var/run/diaspora/diaspora-wsd.pid|' \
-    config/app_config.yml
 
 if rake db:seed:dev; then
     echo "Database config OK, new user tom/evankorth in place"
diff --git a/pkg/fedora/diaspora-wsd b/pkg/fedora/diaspora-wsd
index f99492e80a1a1b71fa90cc878a91fd3c73ea7a4f..6f0c7593f6daaa60e7c5554b25e84dbd751eb0ba 100755
--- a/pkg/fedora/diaspora-wsd
+++ b/pkg/fedora/diaspora-wsd
@@ -33,7 +33,7 @@ cd  /usr/share/diaspora
 RETVAL=0
 prog="Diaspora websocket server"
 exec="script/websocket_server.rb"
-pidfile="/var/run/diaspora/diaspora-wsd"
+pidfile="/var/run/diaspora-wsd"
 lockfile="/var/lock/subsys/diaspora-wsd"
 logfile=/var/log/diaspora-wsd.log
 
diff --git a/pkg/fedora/diaspora.spec b/pkg/fedora/diaspora.spec
index 1d61026e5d29206c9bc3ebee886ac2bd64045aa8..4c0cca719592fd9201300ce046defff33995b0c4 100644
--- a/pkg/fedora/diaspora.spec
+++ b/pkg/fedora/diaspora.spec
@@ -77,7 +77,6 @@ mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/tmp
 cp %SOURCE2  $RPM_BUILD_ROOT/%{_datadir}/diaspora
 
 mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/log/diaspora
-mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/run/diaspora
 mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/uploads
 mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/tmp
 
@@ -95,8 +94,6 @@ find  -L $RPM_BUILD_ROOT/%{_datadir}/diaspora  -type f     \
 cat files >> dirs && mv -f dirs files
 sed -i   -e '\|.*/master/config.ru"$|d'                    \
          -e '\|.*/master/config/environment.rb"$|d'        \
-         -e '\|.*/run/diaspora"$|d'                        \
-         -e '\|.*/pkg/fedora/dist"$|d'                     \
          -e 's|%{buildroot}||' -e 's|//|/|' -e '/""/d'     \
       files
 
@@ -104,7 +101,6 @@ sed -i   -e '\|.*/master/config.ru"$|d'                    \
 %post wsd
 /sbin/chkconfig --add  diaspora-wsd || :
 
-
 %preun  wsd
 if [ $1 -eq 0 ] ; then
     service diaspora-wsd stop  &>/dev/null || :
@@ -121,11 +117,9 @@ rm -fr $RPM_BUILD_ROOT
 %doc AUTHORS README.md GNU-AGPL-3.0 COPYRIGHT README-Fedora.md
 %attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config.ru
 %attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config/environment.rb
-%attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/pkg/fedora/dist
 %attr(-, diaspora, diaspora) %{_localstatedir}/log/diaspora
 %attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/uploads
 %attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/tmp
-%attr(-, diaspora, diaspora) %{_localstatedir}/run/diaspora
 
 %{_datadir}/diaspora/master/tmp
 %{_datadir}/diaspora/master/public/uploads
diff --git a/pkg/fedora/dist/.gitkeep b/pkg/fedora/dist/.gitkeep
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/pkg/fedora/make-dist.sh b/pkg/fedora/make-dist.sh
index dcfafb6e1830f0dbf10d0420240aee3a2ea3cbfa..6777ae773be9faeeb7a9907e1275883fa516f2f9 100755
--- a/pkg/fedora/make-dist.sh
+++ b/pkg/fedora/make-dist.sh
@@ -126,7 +126,8 @@ function checkout()
             git clone --quiet $GIT_REPO;
             (
                 cd diaspora;
-                git remote add upstream $GIT_REPO
+                git remote add upstream \
+                    git://github.com/diaspora/diaspora.git
                 for p in ../../*.patch; do
                     git apply --whitespace=fix  $p  > /dev/null
                 done &> /dev/null || :
@@ -180,6 +181,7 @@ function make_bundle()
 # Usage:  make_bundle [ commit, defaults to HEAD]
 #
 {
+set -x
     checkout ${1:-'HEAD'} >/dev/null
     bundle_id=$( git_id dist/diaspora/Gemfile)
     bundle_name="diaspora-bundle-$VERSION-$bundle_id"
diff --git a/pkg/ubuntu/README.md b/pkg/ubuntu/README.md
index cd633fdfb93cf26e8e288cbaabe4f1446cc89af9..15a4947dc941419a594437973e0badfd29d1e636 100644
--- a/pkg/ubuntu/README.md
+++ b/pkg/ubuntu/README.md
@@ -5,7 +5,6 @@ work as a first step towards packaging, but should be usable as is.
 
 ### Synopsis
 
-
 Bootstrap the distribution from git:
     % sudo apt-get install git-core
     % git clone git://github.com/diaspora/diaspora.git
@@ -80,11 +79,19 @@ dependencies lives in the application - nothing is installed by user or
 on system level.
 
 This has been tested on a Ubuntu 32-bit 10.10 , clean server and on 10.04
-Lucid desktop, also clean installation. Irregular nightly builds are
-available from time to time at
-[ftp://mumin.dnsalias.net/pub/leamas/diaspora/builds](ftp://mumin.dnsalias.net/pub/leamas/diaspora/builds)
+Lucid desktop, also clean installation.
 
 mongodb is having problems occasionally. Sometimes the dependencies are not
 installed, and mongod refuses to start. invoke */usr/bin/mongod -f
 /etc/mongodb.conf* to test. The lockfile /var/lib/mongodb/mongod.conf is
 also a potential problem. Remove to make it start again.
+
+The diaspora-wsd is just placeholder FTM, it does **not** work.
+
+
+
+
+
+
+
+
diff --git a/pkg/ubuntu/diaspora-install b/pkg/ubuntu/diaspora-install
index daaf33b5477f908ee58e5abc07a0764c69621abc..e7cef8f31b345fd2f038246459be251dba56fab8 100755
--- a/pkg/ubuntu/diaspora-install
+++ b/pkg/ubuntu/diaspora-install
@@ -41,8 +41,8 @@ cp master/pkg/ubuntu/diaspora-setup .
 mkdir -p /var/log/diaspora
 mkdir -p /var/lib/diaspora/uploads
 mkdir -p /var/lib/diaspora/tmp
-mkdir -p /var/run/diaspora
 mkdir -p /etc/diaspora
+mkdir -p /usr/share/diaspora/master/pkg/ubuntu/dist
 
 ln -sf /var/log/diaspora  ./master/log
 cp master/config/app_config.yml.example /etc/diaspora/app_config.yml
@@ -65,6 +65,5 @@ chown diaspora:diaspora /var/log/diaspora
 chown diaspora:diaspora /var/lib/diaspora/uploads
 chown diaspora:diaspora /var/lib/diaspora/tmp
 chown diaspora:diaspora /var/lib/diaspora
-chown diaspora:diaspora /var/run/diaspora
 chown diaspora:diaspora /usr/share/diaspora/master/pkg/ubuntu/dist
 
diff --git a/pkg/ubuntu/diaspora-setup b/pkg/ubuntu/diaspora-setup
index 305527d28bc17f72a24665a60e75320ebd33d1b3..3f2c0266c3371512b104428b5b2a5cb22e087fcc 100755
--- a/pkg/ubuntu/diaspora-setup
+++ b/pkg/ubuntu/diaspora-setup
@@ -26,8 +26,6 @@ cd /usr/share/diaspora/master
 
 test -e config/app_config.yml ||
     cp config/app_config.yml.example config/app_config.yml
-sed -i '/socket_pidfile:/s|:.*|: /var/run/diaspora/diaspora-wsd.pid|' \
-    config/app_config.yml
 
 if rake db:seed:dev; then
     echo "Database config OK, new user tom/evankorth in place"
diff --git a/pkg/ubuntu/diaspora-wsd b/pkg/ubuntu/diaspora-wsd
index 0e8d08f2030d2cf992b7e53351005ff9847ef1e4..e80f24f6ea9d40bb9aba5a869cd6b677aec3827a 100755
--- a/pkg/ubuntu/diaspora-wsd
+++ b/pkg/ubuntu/diaspora-wsd
@@ -1,154 +1,102 @@
-#!/bin/sh
+#!/bin/bash
+#
+#	/etc/rc.d/init.d/diaspora-wsd
+#
+# SHOULD start the diaspora websocket daemon, but it doesn't. No way.
+#
+# chkconfig: - 80 80
+# description: Diaspora websocket daemon
+
 ### BEGIN INIT INFO
-# Provides:          diaspora-wsd
-# Required-Start:    $remote_fs $syslog
-# Required-Stop:     $remote_fs $syslog
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: diaspora websocket daemon
-# Description:       The diaspora websocket service provider, normally
-#                    listening on port 8080
+# Provides: diaspora-wsd
+# Required-Start: $local_fs $network
+# Required-Stop: $local_fs $network
+# Should-Start: $remote_fs
+# Should-Stop: $remote_fs
+# Default-Start:
+# Default-Stop: 0 1 2 3 4 5 6
+# Short-Description: start and stop Diaspora websocket server
+# Description: The websocket server provides websocket services for
+#              diaspora.
 ### END INIT INFO
 
-# Author: Alec leamas <leamas.alec@gmail.com>
-
-PATH=/bin:/sbin:/usr/sbin:/usr/bin
-DESC="Websocket server for diaspora clients"
-NAME='diaspora-wsd'
-DAEMON='/usr/local/bin/bundle'
-DAEMON_ARGS=' exec ruby ./script/websocket_server.rb'
-PIDFILE=/var/run/diaspora/diaspora-wsd.pid
-SCRIPTNAME=/etc/init.d/diaspora-wsd
-
-cd /usr/share/diaspora/master
-
-[ -x "$DAEMON" ] || exit 0
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-
-# Load the VERBOSE setting and other rcS variables
-. /lib/init/vars.sh
-
-# Define LSB log_* functions.
-# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
-. /lib/lsb/init-functions
-
-#
-# Function that starts the daemon/service
-#
-do_start()
-{
-	# Return
-	#   0 if daemon has been started
-	#   1 if daemon was already running
-	#   2 if daemon could not be started
-        [ -f $PIDFILE ] && {
-            pid=$( cat $PIDFILE)
-            name=$( ps -p "$pid" -o comm= 2> /dev/null) || :
-            [ "$name" = "ruby" ] && return 1
-        }
-	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
-            --chdir $PWD -- $DAEMON_ARGS \
-		|| return 2
-        return 0
+# Source function library.
+. /etc/init.d/functions
+
+if [ -f /etc/sysconfig/diaspora-wsd -a $UID -eq 0 ]; then
+    . /etc/sysconfig/diaspora-wsd
+fi
+
+# Note: this line is patched by installation scripts.
+cd  /usr/share/diaspora
+
+RETVAL=0
+prog="Diaspora websocket server"
+exec="script/websocket_server.rb"
+pidfile="/var/run/diaspora-wsd"
+lockfile="/var/lock/subsys/diaspora-wsd"
+logfile=/var/log/diaspora-wsd.log
+
+[ -n "$OPTIONS" ] && OPTIONS=" $OPTIONS"
+ruby_cmd="ruby -C $PWD $exec$OPTIONS"
+
+start() {
+	[ $UID -eq 0 ] || exit 4
+	[ -f $exec ]   || exit 5
+
+        echo -n $"Starting $prog: "
+	daemon --pidfile $pidfile "$ruby_cmd >>$logfile 2>&1 &"
+	RETVAL=$?
+        echo
+	if test $RETVAL = 0; then
+            touch  $lockfile
+            pgrep -f "$ruby_cmd" > $pidfile || {
+                echo "Warning: cannot find running diaspora-webserver"
+                exit 7
+            }
+        fi
 }
 
-#
-# Function that stops the daemon/service
-#
-do_stop()
-{
-	# Return
-	#   0 if daemon has been stopped
-	#   1 if daemon was already stopped
-	#   2 if daemon could not be stopped
-	#   other if a failure occurred
-	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE \
-            --name $NAME --chdir $PWD
-	RETVAL="$?"
-	[ "$RETVAL" = 2 ] && return 2
-	# Wait for children to finish too if this is a daemon that forks
-	# and if the daemon is only ever run from this initscript.
-	# If the above conditions are not satisfied then add some other code
-	# that waits for the process to drop all resources that could be
-	# needed by services started subsequently.  A last resort is to
-	# sleep for some time.
-	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --chdir $PWD \
-            --exec $DAEMON
-	[ "$?" = 2 ] && return 2
-	# Many daemons don't delete their pidfiles when they exit.
-	rm -f $PIDFILE
-	return "$RETVAL"
+stop() {
+	[ $UID -eq 0 ] || exit 4
+	echo -n $"Stopping $prog: "
+	killproc -p $pidfile $exec
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && rm -f $lockfile
+	echo
 }
 
 #
-# Function that sends a SIGHUP to the daemon/service
+#	See how we were called.
 #
-do_reload() {
-	#
-	# If the daemon can reload its configuration without
-	# restarting (for example, when it is sent a SIGHUP),
-	# then implement that here.
-	#
-	start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --chdir $PWD \
-        --name $NAME
-	return 0
-}
-
 case "$1" in
   start)
-	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
-	do_start
-	case "$?" in
-		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
-		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
-	esac
+	start
 	;;
-
   stop)
-	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
-	do_stop
-	case "$?" in
-		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
-		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
-	esac
+	stop
 	;;
-
-  status)
-       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
-       ;;
-
-  #reload|force-reload)
-	#
-	# If do_reload() is not implemented then leave this commented out
-	# and leave 'force-reload' as an alias for 'restart'.
-	#
-	#log_daemon_msg "Reloading $DESC" "$NAME"
-	#do_reload
-	#log_end_msg $?
-	#;;
-
-  restart|force-reload)
-	log_daemon_msg "Restarting $DESC" "$NAME"
-	do_stop
-	case "$?" in
-	  0|1)
-		do_start
-		case "$?" in
-			0) log_end_msg 0 ;;
-			1) log_end_msg 1 ;; # Old process is still running
-			*) log_end_msg 1 ;; # Failed to start
-		esac
-		;;
-	  *)
-	  	# Failed to stop
-		log_end_msg 1
-		;;
-	esac
+  force-reload|restart)
+	stop
+	sleep 1
+	start
+	RETVAL=$?
 	;;
-
-  *) echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
-	exit 3
+  condrestart|try-restart)
+	if [ -f $lockfile ]; then
+	    stop
+	    sleep 3
+	    start
+	fi
+	;;
+  status)
+	status -p $pidfile $exec
+	RETVAL=$?
 	;;
+  *)
+	echo $"Usage: $0 {condrestart|try-restart|start|stop|restart|force-reload|status}"
+	RETVAL=2
+	[ "$1" = 'usage' ] && RETVAL=0
 esac
 
-:
+exit $RETVAL
diff --git a/pkg/ubuntu/dist/.gitkeep b/pkg/ubuntu/dist/.gitkeep
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/script/websocket_server.rb b/script/websocket_server.rb
index 64f6ddf8a4f290d1d7f9597415f6c2990be6e918..65199175e6258e3f06eeebe23dde14171a8f50ea 100644
--- a/script/websocket_server.rb
+++ b/script/websocket_server.rb
@@ -5,27 +5,6 @@
 require File.dirname(__FILE__) + '/../config/environment'
 require File.dirname(__FILE__) + '/../lib/diaspora/websocket'
 
-at_exit do
-  begin
-    File.delete(PID_FILE)
-  rescue
-    puts 'Cannot remove pidfile: ' + (PID_FILE ? PID_FILE : "NIL")
-  end
-end
-
-def write_pidfile
-  begin
-    f = File.open(PID_FILE, "w")
-    f.write(Process.pid)
-    f.close
-  rescue => e
-    puts "Can't write to pidfile!"
-    puts e.inspect
-    puts e.backtrace
-  end
-end
-
-
 CHANNEL = Magent::GenericChannel.new('websocket')
 def process_message
   if CHANNEL.queue_count > 0
@@ -58,8 +37,6 @@ begin
       }
     end
 
-    PID_FILE = APP_CONFIG[:socket_pidfile]
-    write_pidfile
     puts "Websocket server started."
     process_message
   }