Kodi

Standard method, via init script
First create the xbmc user

Then define the xbmc init.d file with the following contents

Set the appropriate permissions

And tell openrc to start it on boot

Alternative method, via inittab
This is based on the way the mythtv ebuilds enable the autostart of the mythtv frontend.

First create the xbmc user

Define an xinitrc file in xbmc's home

Then create the login scripts

Finally append an inittab entry which does the autologin

Shutdown
Allow the xbmc user to issue an shutdown via polkit, resulting in a shutdown option in the XBMC menu:

Note: ensure you have the udev USE flag set for shutdown to work

Hardened profile notes
XBMC runs in hardened profiles. One caveat is that to get networking fully working, CONFIG_GRKERNSEC_PROC_USER kernel option has to be unset. If you want to restrict /proc access, set CONFIG_GRKERNSEC_PROC_USERGROUP and GRKERNSEC_PROC_GID to a special group that will have access to /proc filesystem. You can then add add xbmc user to this group.

External resources

 * http://xbmc.org/
 * Unofficial XBMC Overlay