
MESSAGEUSER=messagebus
MESSAGEHOME=/var/run/dbus
LAUNCHER=/usr/lib/dbus-1.0/dbus-daemon-launch-helper
[ -f /bin/dbus-daemon ] && ln -sf /bin/dbus-daemon /usr/bin/
[ -f /bin/dbus-uuidgen ] && ln -sf /bin/dbus-uuidgen /usr/bin/

    mkdir -p /var/run/dbus
    mkdir -p /etc/dbus-1/system.d
    mkdir -p /etc/dbus-1/session.d
#    adduser --system \
#            --quiet \
#            --home "$MESSAGEHOME" \
#            --no-create-home \
#            --disabled-password \
#            --group "$MESSAGEUSER"
	    
	    rm "$LAUNCHER"
	    cp /tmp/tcloop/APPNAME/"$LAUNCHER" "$LAUNCHER"
            chown root:"$MESSAGEUSER" "$LAUNCHER"
            chmod 4755 "$LAUNCHER"
	    addgroup "$MESSAGEUSER"
	    
    # This is idempotent, so it's OK to do every time. The system bus' init
    # script does this anyway, but you also have to do this before a session
    # bus will work, so we do this here for the benefit of people starting
    # a temporary session bus in a chroot
    dbus-uuidgen > /etc/machine-id



    # This is what the init script would do, but it's simpler (and less
    # dependent on sysvinit vs. Upstart) if we do it directly.
    # If it's not running (perhaps we're in a chroot) this will just fail
    # harmlessly, so there's no need to condition on status.
    dbus-send --print-reply --system --type=method_call \
            --dest=org.freedesktop.DBus \
            / org.freedesktop.DBus.ReloadConfig > /dev/null || true
/bb/adduser -S -DH messagebus -G messagebus 
/etc/init.d/dbus start


exit 0

