Auto Starting MythTV

in Gentoo


Steps:
  1. add USE=autostart to your USE flags via /etc/make.conf or /etc/portage/package.use
  2. emerge mythtv
  3. Edit /etc/inittab, at the end of the TERMINALS section add
    c8:2345:respawn:/sbin/mingetty --autologin mythtv tty8
  4. 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.


I personally feel this is a much more sensible way of doing things then the KDM way at Gentoo Wiki since it's much lighter weight then starting a whole KDE session for MythTV and having all the KDE depends. The other way suggested was to run X via an init script, which is poor security wise since X runs as fully privledged root and has no means for fault tolerance other then a while loop which wastes CPU cycles.


If you have any issues using this or any suggestions feel free to drop me a line via e-mail cardoe at gentoo dot org or file a bug in Gentoo's Bugzilla.