Auto Starting MythTV in Gentoo
- add USE=autostart to your USE flags via /etc/make.conf or /etc/portage/package.use
- emerge mythtv
- Edit /etc/inittab, at the end of the TERMINALS section add
c8:2345:respawn:/sbin/mingetty --autologin mythtv tty8
- Watch TV!
In theory that should be all that's necessary. This is of course assuming you have your X.org server configured and working properly.
How it works
/etc/inittab is the configuration file for the init process. init starts up your tty handlers so that your console work. Essentially we're adding another tty, tty8, that automatically logs in the mythtv user.
Since bash is the shell set for the mythtv user, we're providing a $HOME/.bash_profile that gets run when the user logins in. This checks to see if we're being started on tty8, and if we are it runs startx.
xinitruns $HOME/.xinitrc which executes nvidia-settings for people that need it to enable their TV-out. Then via xset it disables the screensaver and dpms screen blanking. It then starts evilwm, an extremely light window manager for users that prefer to use xine or mplayer as their media player and lastly starts mythfrontend as the foreground app.
If mythfrontend crashes, X will exist and the next line in $HOME/.bash_profile is logout. Which causes bash to logout, closing your tty. init immediately notices this and starts back at the top.