OpenRC/Prefix

This work is a reponse to.

Article description::The following guideline applies to a Gentoo [[Prefix on RHEL-5.6 amd64 and on Debian 6.0 amd64, for other setups it should be similar.]] Feel free to documents corner cases here.

Getting openrc on Prefix
Specify the system to be Prefix:

Start OpenRC Automatically
As a service manager, OpenRC is more useful to be started automatically.

/etc/rc.local
Many distributions provide /etc/rc.local as a site specific place start services.

If you have root access to the host, start OpenRC from /etc/rc.local:

crontab
If your do not have root access to the host, but the host has cron, you can hook OpenRC into crontab on every reboot.

.profile
If the host does not even have cron, OpenRC can be started from login shell. Taking bash for example,

OpenRC does nothing if a runlevel is entered again. Logging in (and entering default runlevel) many times does not have side-effects.

XXX is already starting
OpenRC needs to enter some runlevel to initiate the runtime status directores in EPREFIX/var/run/openrc to really start anything.

Example: tinc
tinc is a decentralized VPN. A tinc started from Gentoo Prefix can serve as a relay node in the VPN, if tun/tap is not available for normal user.

emerge tinc, or re-emerge to get its {init,conf}.d files back with our new portage

fire up tincd from OpenRC
Make necessary changes in ${EPREFIX}/etc/conf.d/tinc.networks and ${EPREFIX}/etc/tinc according to your specific setup.

Add tincd into default runlevel

Finally we are done with

Example: nginx
nginx is a small, robust and high-performance web server.

Emerge nginx, or re-emerge to get its initd and confd files back with our new portage:

normal privilege

 * remove "user nginx nginx;" from the first line of ${EPREFIX}/etc/nginx/nginx.conf
 * You cannot listen on port 80 without root privilege. Change it to 8008,