Bring Back prefix support

We now have a team member who is interested in OpenRC on prefix, so I am
bringing it back to the main tree.
This commit is contained in:
William Hubbs 2012-07-02 22:04:22 -05:00
parent a6db2374fe
commit e641b43849
49 changed files with 75 additions and 40 deletions

View File

@ -4,6 +4,7 @@
# This is the subsystem type. Valid options on FreeBSD: # This is the subsystem type. Valid options on FreeBSD:
# "" - nothing special # "" - nothing special
# "jail" - FreeBSD jails # "jail" - FreeBSD jails
# "prefix" - Prefix
# If this is commented out, automatic detection will be used. # If this is commented out, automatic detection will be used.
# #
# This should be set to the value representing the environment this file is # This should be set to the value representing the environment this file is

View File

@ -5,6 +5,7 @@
# "" - nothing special # "" - nothing special
# "lxc" - Linux Containers # "lxc" - Linux Containers
# "openvz" - Linux OpenVZ # "openvz" - Linux OpenVZ
# "prefix" - Prefix
# "uml" - Usermode Linux # "uml" - Usermode Linux
# "vserver" - Linux vserver # "vserver" - Linux vserver
# "xen0" - Xen0 Domain # "xen0" - Xen0 Domain

View File

@ -3,6 +3,7 @@
# This is the subsystem type. Valid options on NetBSD: # This is the subsystem type. Valid options on NetBSD:
# "" - nothing special # "" - nothing special
# "prefix" - Prefix
# "xen0" - Xen0 Domain # "xen0" - Xen0 Domain
# "xenU" - XenU Domain # "xenU" - XenU Domain
# If this is commented out, automatic detection will be used. # If this is commented out, automatic detection will be used.

View File

@ -22,7 +22,7 @@ depend()
[ "$clock" != "UTC" -a ! -e /etc/wall_cmos_clock ]; then [ "$clock" != "UTC" -a ! -e /etc/wall_cmos_clock ]; then
need root need root
fi fi
keyword -jail keyword -jail -prefix
} }
start() start()

View File

@ -7,7 +7,7 @@ depend()
need localmount need localmount
before logger before logger
after clock sysctl after clock sysctl
keyword -timeout keyword -prefix -timeout
} }
: ${wipe_tmp:=${WIPE_TMP:-yes}} : ${wipe_tmp:=${WIPE_TMP:-yes}}

View File

@ -8,7 +8,7 @@ depend()
{ {
need localmount termencoding need localmount termencoding
after hotplug bootmisc after hotplug bootmisc
keyword -openvz -uml -vserver -xenu -lxc keyword -openvz -prefix -uml -vserver -xenu -lxc
} }
start() start()

View File

@ -10,7 +10,7 @@ depend() {
need localmount need localmount
after bootmisc after bootmisc
before net.lo0 before net.lo0
keyword -jail keyword -jail -prefix
} }
start_pre() { start_pre() {

View File

@ -6,7 +6,7 @@ description="Mount system critical filesystems in /dev."
depend() { depend() {
use dev use dev
keyword -vserver keyword -prefix -vserver
} }
start() { start() {

View File

@ -6,7 +6,7 @@ description="Configures a specific kernel dump device."
depend() { depend() {
need swap need swap
keyword -jail keyword -jail -prefix
} }
start() { start() {

View File

@ -9,7 +9,7 @@ _IFS="
depend() depend()
{ {
use dev clock modules use dev clock modules
keyword -jail -openvz -timeout -vserver -lxc keyword -jail -openvz -prefix -timeout -vserver -lxc
} }
_abort() { _abort() {

View File

@ -9,7 +9,7 @@ depend()
{ {
use root use root
before devd net before devd net
keyword -jail keyword -jail -prefix
} }
_set() _set()

View File

@ -5,7 +5,7 @@
description="Sets the hostname of the machine." description="Sets the hostname of the machine."
depend() { depend() {
keyword -lxc keyword -prefix -lxc
} }
start() start()

View File

@ -28,7 +28,7 @@ depend()
else else
before * before *
fi fi
keyword -openvz -uml -vserver -xenu -lxc keyword -openvz -prefix -uml -vserver -xenu -lxc
} }
setupopts() setupopts()

View File

@ -8,7 +8,7 @@ depend()
{ {
need localmount termencoding need localmount termencoding
after bootmisc after bootmisc
keyword -openvz -uml -vserver -xenu -lxc keyword -openvz -prefix -uml -vserver -xenu -lxc
} }
start() start()

View File

@ -4,6 +4,11 @@
description="Kill all processes so we can unmount disks cleanly." description="Kill all processes so we can unmount disks cleanly."
depend()
{
keyword -prefix
}
start() start()
{ {
ebegin "Terminating remaining processes" ebegin "Terminating remaining processes"

View File

@ -9,7 +9,7 @@ depend()
need fsck need fsck
use lvm modules mtab use lvm modules mtab
after lvm modules after lvm modules
keyword -jail -openvz -vserver -lxc keyword -jail -openvz -prefix -vserver -lxc
} }
start() start()

View File

@ -7,7 +7,7 @@ extra_commands="restore"
depend() depend()
{ {
need localmount need localmount
keyword -jail keyword -jail -prefix
} }
restore() restore()

View File

@ -7,7 +7,7 @@ description="Loads a user defined list of kernel modules."
depend() depend()
{ {
use isapnp use isapnp
keyword -openvz -vserver -lxc keyword -openvz -prefix -vserver -lxc
} }
start() start()

View File

@ -7,7 +7,7 @@ description="Re-mount filesytems read-only for a clean reboot."
depend() depend()
{ {
need killprocs savecache need killprocs savecache
keyword -openvz -vserver -lxc keyword -openvz -prefix -vserver -lxc
} }
start() start()

View File

@ -16,7 +16,7 @@ depend()
{ {
need localmount need localmount
after bootmisc after bootmisc
keyword -jail keyword -jail -prefix
} }
start() start()

View File

@ -7,6 +7,7 @@ description="Update /etc/mtab to match what the kernel knows about"
depend() depend()
{ {
need root need root
keyword -prefix
} }
start() start()

View File

@ -23,7 +23,7 @@ depend()
need sysfs need sysfs
fi fi
after bootmisc after bootmisc
keyword -jail -vserver keyword -jail -prefix -vserver
case "${IFACE}" in case "${IFACE}" in
lo|lo0) provide lo;; lo|lo0) provide lo;;

View File

@ -35,7 +35,7 @@ depend()
need net $pmap need net $pmap
use afc-client amd autofs openvpn use afc-client amd autofs openvpn
use dns nfs nfsmount portmap rpcbind rpc.statd rpc.lockd use dns nfs nfsmount portmap rpcbind rpc.statd rpc.lockd
keyword -jail -vserver keyword -jail -prefix -vserver
} }
start() start()

View File

@ -13,7 +13,7 @@ depend()
need localmount need localmount
after bootmisc after bootmisc
provide net provide net
keyword -jail -vserver keyword -jail -prefix -vserver
} }
uniqify() uniqify()

View File

@ -7,6 +7,7 @@ required_files="/etc/newsyslog.conf"
depend() depend()
{ {
need localmount need localmount
keyword -prefix
} }
start() start()

View File

@ -9,7 +9,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
depend() depend()
{ {
need localmount need localmount
keyword -openvz -vserver -lxc keyword -openvz -prefix -vserver -lxc
} }
_setleds() _setleds()

View File

@ -11,7 +11,7 @@ extra_started_commands="reload"
depend() { depend() {
need localmount need localmount
keyword -jail keyword -jail -prefix
} }
start() start()

View File

@ -12,7 +12,7 @@ depend()
need localmount need localmount
use logger use logger
after bootmisc after bootmisc
keyword -jail keyword -jail -prefix
} }
start_pre() start_pre()

View File

@ -8,7 +8,7 @@ depend()
{ {
use modules devfs use modules devfs
need localmount need localmount
keyword -openvz -vserver -lxc keyword -openvz -prefix -vserver -lxc
} }
start() start()

View File

@ -7,6 +7,7 @@ depend()
need localmount net need localmount net
after * after *
before local before local
keyword -prefix
} }
start() start()

View File

@ -7,7 +7,7 @@ description="Mount the root fs read/write"
depend() depend()
{ {
need fsck need fsck
keyword -jail -openvz -vserver -lxc keyword -jail -openvz -prefix -vserver -lxc
} }
start() start()

View File

@ -8,7 +8,7 @@ depend()
{ {
need dumpon localmount need dumpon localmount
before encswap before encswap
keyword -jail keyword -jail -prefix
} }
start() start()

View File

@ -12,7 +12,7 @@ depend()
{ {
provide net provide net
use network use network
keyword -jail -vserver keyword -jail -prefix -vserver
} }
pre_flight_checks() pre_flight_checks()

View File

@ -5,7 +5,7 @@
depend() depend()
{ {
before fsck before fsck
keyword -jail keyword -jail -prefix
} }
start() start()

View File

@ -5,7 +5,7 @@
depend() depend()
{ {
before localmount before localmount
keyword -jail -openvz -vserver -lxc keyword -jail -openvz -prefix -vserver -lxc
} }
start() start()

View File

@ -8,7 +8,7 @@ depend()
{ {
before * before *
provide clock provide clock
keyword -openvz -uml -vserver -xenu -lxc keyword -openvz -prefix -uml -vserver -xenu -lxc
} }
# swclock is an OpenRC built in # swclock is an OpenRC built in

View File

@ -4,7 +4,7 @@
depend() { depend() {
need localmount need localmount
keyword -jail keyword -jail -prefix
} }
start() { start() {

View File

@ -5,6 +5,7 @@
depend() depend()
{ {
before bootmisc logger before bootmisc logger
keyword -prefix
} }
start() start()

View File

@ -5,7 +5,7 @@
depend() depend()
{ {
before bootmisc logger before bootmisc logger
keyword -lxc -vserver keyword -lxc -prefix -vserver
} }
start() start()

View File

@ -6,7 +6,7 @@ description="Mount the sys filesystem."
depend() depend()
{ {
keyword -vserver keyword -prefix -vserver
} }
mount_sys() mount_sys()

View File

@ -16,4 +16,5 @@ depend()
use net newsyslog use net newsyslog
need localmount need localmount
after bootmisc after bootmisc
keyword -prefix
} }

View File

@ -9,7 +9,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
depend() depend()
{ {
keyword -lxc -openvz -uml -vserver -xenu keyword -lxc -openvz -prefix -uml -vserver -xenu
use root use root
after bootmisc after bootmisc
} }

View File

@ -5,6 +5,7 @@
depend() depend()
{ {
after fsck after fsck
keyword -prefix
} }
start() start()

View File

@ -8,7 +8,7 @@ description="Initializes the random number generator."
depend() depend()
{ {
need localmount need localmount
keyword -jail -openvz keyword -jail -openvz -prefix
} }
save_seed() save_seed()

View File

@ -5,6 +5,7 @@
depend() depend()
{ {
need localmount need localmount
keyword -prefix
} }
start() start()

View File

@ -180,6 +180,8 @@ in
Same as -jail, but for Linux Resource Containers (LXC). Same as -jail, but for Linux Resource Containers (LXC).
.It Dv -openvz .It Dv -openvz
Same as -jail, but for OpenVZ systems. Same as -jail, but for OpenVZ systems.
.It Dv -prefix
Same as -jail, but for Prefix systems.
.It Dv -uml .It Dv -uml
Same as -jail, but for UML systems. Same as -jail, but for UML systems.
.It Dv -vserver .It Dv -vserver
@ -388,8 +390,9 @@ rc_provide_tap1="!net"
# To put in in /etc/rc.conf you would do it like this # To put in in /etc/rc.conf you would do it like this
rc_net_tap1_provide="!net" rc_net_tap1_provide="!net"
# It's also possible to negate keywords. # It's also possible to negate keywords. This is mainly useful for prefix
rc_keyword="-keyword" # users testing OpenRC.
rc_keyword="!-prefix"
.Ed .Ed
.Sh EXAMPLES .Sh EXAMPLES
.Pp .Pp

View File

@ -53,24 +53,34 @@ install:
if ! test -d "${SYSINITDIR}"; then \ if ! test -d "${SYSINITDIR}"; then \
${INSTALL} -d ${SYSINITDIR} || exit $$?; \ ${INSTALL} -d ${SYSINITDIR} || exit $$?; \
for x in ${SYSINIT}; do \ for x in ${SYSINIT}; do \
ln -snf ${PREFIX}/etc/init.d/"$$x" ${SYSINITDIR}/"$$x" || exit $$?; \ if test -n "${PREFIX}"; then \
done \ grep -q "keyword .*-prefix" ${INITDIR}/"$$x" && continue; \
fi; \
ln -snf ${PREFIX}/etc/init.d/"$$x" ${SYSINITDIR}/"$$x" || exit $$?; done \
fi fi
if ! test -d "${BOOTDIR}"; then \ if ! test -d "${BOOTDIR}"; then \
${INSTALL} -d ${BOOTDIR} || exit $$?; \ ${INSTALL} -d ${BOOTDIR} || exit $$?; \
for x in ${BOOT}; do \ for x in ${BOOT}; do \
if test -n "${PREFIX}"; then \
grep -q "keyword .*-prefix" ${INITDIR}/"$$x" && continue; \
fi; \
ln -snf ${PREFIX}/etc/init.d/"$$x" ${BOOTDIR}/"$$x" || exit $$?; \ ln -snf ${PREFIX}/etc/init.d/"$$x" ${BOOTDIR}/"$$x" || exit $$?; \
done \ done \
fi fi
if ! test -d "${DEFAULTDIR}"; then \ if ! test -d "${DEFAULTDIR}"; then \
${INSTALL} -d ${DEFAULTDIR} || exit $$?; \ ${INSTALL} -d ${DEFAULTDIR} || exit $$?; \
for x in ${DEFAULT}; do \ for x in ${DEFAULT}; do \
ln -snf ${PREFIX}/etc/init.d/"$$x" ${DEFAULTDIR}/"$$x" || exit $$?; \ if test -n "${PREFIX}"; then \
done \ grep -q "keyword .*-prefix" ${INITDIR}/"$$x" && continue; \
fi; \
ln -snf ${PREFIX}/etc/init.d/"$$x" ${DEFAULTDIR}/"$$x" || exit $$?; done \
fi fi
if ! test -d "${SHUTDOWNDIR}"; then \ if ! test -d "${SHUTDOWNDIR}"; then \
${INSTALL} -d ${SHUTDOWNDIR} || exit $$?; \ ${INSTALL} -d ${SHUTDOWNDIR} || exit $$?; \
for x in ${SHUTDOWN}; do \ for x in ${SHUTDOWN}; do \
if test -n "${PREFIX}"; then \
grep -q "keyword .*-prefix" ${INITDIR}/"$$x" && continue; \
fi; \
ln -snf ${PREFIX}/etc/init.d/"$$x" ${SHUTDOWNDIR}/"$$x" || exit $$?; done \ ln -snf ${PREFIX}/etc/init.d/"$$x" ${SHUTDOWNDIR}/"$$x" || exit $$?; done \
fi fi

View File

@ -216,6 +216,7 @@ rc_sys_v2(void)
} }
/* Now do detection */ /* Now do detection */
__STRING_SWITCH(systype) __STRING_SWITCH(systype)
__STRING_CASE(RC_SYS_PREFIX) { return RC_SYS_PREFIX; }
#ifdef __FreeBSD__ #ifdef __FreeBSD__
__STRING_CASE(RC_SYS_JAIL) { return RC_SYS_JAIL; } __STRING_CASE(RC_SYS_JAIL) { return RC_SYS_JAIL; }
#endif /* __FreeBSD__ */ #endif /* __FreeBSD__ */
@ -245,6 +246,10 @@ librc_hidden_def(rc_sys_v2)
const char * const char *
rc_sys_v1(void) rc_sys_v1(void)
{ {
#ifdef PREFIX
return RC_SYS_PREFIX;
#else
#ifdef __FreeBSD__ #ifdef __FreeBSD__
int jailed = 0; int jailed = 0;
size_t len = sizeof(jailed); size_t len = sizeof(jailed);
@ -281,6 +286,7 @@ rc_sys_v1(void)
#endif #endif
return NULL; return NULL;
#endif /* PREFIX */
} }
librc_hidden_def(rc_sys_v1) librc_hidden_def(rc_sys_v1)

View File

@ -280,6 +280,7 @@ bool rc_service_daemons_crashed(const char *);
#define RC_SYS_JAIL "JAIL" #define RC_SYS_JAIL "JAIL"
#define RC_SYS_OPENVZ "OPENVZ" #define RC_SYS_OPENVZ "OPENVZ"
#define RC_SYS_LXC "LXC" #define RC_SYS_LXC "LXC"
#define RC_SYS_PREFIX "PREFIX"
#define RC_SYS_UML "UML" #define RC_SYS_UML "UML"
#define RC_SYS_VSERVER "VSERVER" #define RC_SYS_VSERVER "VSERVER"
#define RC_SYS_XEN0 "XEN0" #define RC_SYS_XEN0 "XEN0"