Kodi

Kodi (formerly XBMC) is a media center application.

Create user
First create the kodi user:

OpenRC
Then define the Kodi file with the following contents:

Set the appropriate permissions:

And tell openrc to start it on boot:

Using inittab
First create the kodi user (see above). This is based on the way the mythtv ebuilds enable the autostart of the mythtv frontend.

Define an xinitrc file in kodi's home:

Then create the login scripts:

Finally append an inittab entry which does the autologin:

Running on Gentoo Hardened
Running Kodi on a Hardened Gentoo installation is possible. To avoid grsecurity interfering with network connectivity, the CONFIG_GRKERNSEC_PROC_USER kernel option must not be enabled.

Should you require a restricted filesystem, use CONFIG_GRKERNSEC_PROC_USERGROUP and set GRKERNSEC_PROC_GID to the ID of a group that the user running Kodi is a member of.

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

Note: Ensure the  USE flag set for shutdown to work.

External resources

 * Unofficial Kodi Overlay