OpenRC/Prefix

This work is a reponse to.

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.

Using heroxbd's overlay
This is a developer's overlay by heroxbd. The changes will be reviewed and included in the official tree gradually. As of Aug 11, 2012, the overlay includes sys-apps/portage-9999 (for keeping /etc/{init,conf}.d and fixing shebangs inside), sys-apps/openrc-9999 (for adding back Prefix support and exporting EPREFIX) and baselayout-prefix (to avoid file collision).

Let's add heroxbd's overlay with Layman from app-portage/layman,

Make sure overlays from layman are effective,

replace /gentoo with your own $EPREFIX.

Details for playing with layman can be found at Layman.

install baselayout-prefix and portage from the overlay

 * Default portage in prefix removes /etc/{init,conf}.d directories with prompts like
 * removed /etc/init.d and /etc/conf.d directories until bug #196294 has been resolved

emerge portage from heroxbd's overlay to disable this behavior.


 * baselayout-prefix comes from baselayout-1, which has file-collision with openrc. emerge baselayout-prefix from the overlay to remove the offending files.

Getting openrc-9999 emerged on prefix
openrc is not out of box now, first attempt gives

Let's eliminate the blocks.

glibc and sysvinit
In Gentoo Prefix, glibc and sysvinit are supposed to be provided outside Prefix by host OS. Let's tell portage that we have any version of glibc and sysvinit she wants:

now it becomes,

Finally emerge openrc-9999,

Unmask openrc-9999 as guided. (This is just a temperary solution, will be integraded into openrc soon.)

OpenRC config
Use the prefix feature set in openrc,

remove dmesg from sysinit, because we don't manange dmesg from Preifx

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 initd and confd files back with our new portage

prefixify init script
fix shebang in the init script,

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 efficient lightweight http server.

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

prefixify init script
fix shebang in the init script,

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,

External resources
Benda's OpenRC page