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:
# "" - nothing special
# "jail" - FreeBSD jails
# "prefix" - Prefix
# If this is commented out, automatic detection will be used.
#
# This should be set to the value representing the environment this file is

View File

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

View File

@ -3,6 +3,7 @@
# This is the subsystem type. Valid options on NetBSD:
# "" - nothing special
# "prefix" - Prefix
# "xen0" - Xen0 Domain
# "xenU" - XenU Domain
# 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
need root
fi
keyword -jail
keyword -jail -prefix
}
start()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -216,6 +216,7 @@ rc_sys_v2(void)
}
/* Now do detection */
__STRING_SWITCH(systype)
__STRING_CASE(RC_SYS_PREFIX) { return RC_SYS_PREFIX; }
#ifdef __FreeBSD__
__STRING_CASE(RC_SYS_JAIL) { return RC_SYS_JAIL; }
#endif /* __FreeBSD__ */
@ -245,6 +246,10 @@ librc_hidden_def(rc_sys_v2)
const char *
rc_sys_v1(void)
{
#ifdef PREFIX
return RC_SYS_PREFIX;
#else
#ifdef __FreeBSD__
int jailed = 0;
size_t len = sizeof(jailed);
@ -281,6 +286,7 @@ rc_sys_v1(void)
#endif
return NULL;
#endif /* PREFIX */
}
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_OPENVZ "OPENVZ"
#define RC_SYS_LXC "LXC"
#define RC_SYS_PREFIX "PREFIX"
#define RC_SYS_UML "UML"
#define RC_SYS_VSERVER "VSERVER"
#define RC_SYS_XEN0 "XEN0"