crosswalk-project/crosswalk — pull request #1412 by cmarcelo (2013-12-27 16:50:47+00:00)
Title: [Tizen] Install support files for "run as service" mode

This commit adds to the installation the support files for D-Bus and
systemd to make Crosswalk auto activated by D-Bus and managed by
systemd (in the user session). The xwalkctl and xwalk-launcher
applications should be used to interact with service mode.

Crosswalk is installed as a systemd user service, named
xwalk.service. To check it's status, you can use (always with app user
on Tizen 2.x)

$ whoami
app

[ Because shell via sdb doesn't set the right D-Bus session address,
we need to set it manually because systemctl uses it. Our xwalk
tools on Tizen will automatically find the right address. ]

$ export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/app/dbus/user_bus_socket
$ systemctl --user status xwalk.service

Other regular systemd commands (restart, stop, start) should work as
well. Because of D-Bus auto activation feature, Crosswalk doesn't need
to be manually started. Just invoke xwalkctl or xwalk-launcher, and
Crosswalk will be started behind the scenes.

In service mode, the logs of Crosswalk go to systemd's "journal". You
can check that by using (as root, at the moment)

[ Trick to show more information ]

# export COLUMNS=1000
# systemd-journalctl _COMM=xwalk

For debugging it might be useful to directly run Crosswalk (to use gdb
or other tools), in that case, stop the current running Crosswalk using
'systemctl --user stop xwalk.service' and run xwalk binary directly
passing '--run-as-service'.

For now, we still support the current (non-service) way of using
Crosswalk. To avoid conflicts in the configuration files, we use a
different data directory (in $HOME). This means that we have different
app database, so do not expect apps installed in one way to work in
another.

Once we make sure service mode is running OK, we plan to remove the
current way of using Crosswalk (at least on Tizen)

- remove the "xwalk --install and --uninstall" switches;
- remove the "xwalk" script from $PATH;
- and then make the service mode default.

What is still missing in service mode is support for the Tizen-specific
steps of the installation (making the installed app appear on the
homescreen) and tighter integration with Tizen task switcher. Those will
come in following patches.