Kodi

Kodi (formerly XBMC) is a media center application.

Using OpenRC
First create the kodi user:

Then define the Kodi file with the following contents:

Set the appropriate permissions:

And tell openrc to start it on boot:

Using inittab
This is based on the way the mythtv ebuilds enable the autostart of the mythtv frontend.

First create the kodi user:

Define an xinitrc file in kodi's home:

Then create the login scripts:

Finally append an inittab entry which does the autologin

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

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.

External resources

 * Unofficial Kodi Overlay