mirror of
https://github.com/OpenRC/openrc.git
synced 2024-11-27 11:54:26 +08:00
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:
parent
a6db2374fe
commit
e641b43849
@ -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
|
||||
|
@ -5,6 +5,7 @@
|
||||
# "" - nothing special
|
||||
# "lxc" - Linux Containers
|
||||
# "openvz" - Linux OpenVZ
|
||||
# "prefix" - Prefix
|
||||
# "uml" - Usermode Linux
|
||||
# "vserver" - Linux vserver
|
||||
# "xen0" - Xen0 Domain
|
||||
|
@ -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.
|
||||
|
@ -22,7 +22,7 @@ depend()
|
||||
[ "$clock" != "UTC" -a ! -e /etc/wall_cmos_clock ]; then
|
||||
need root
|
||||
fi
|
||||
keyword -jail
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -7,7 +7,7 @@ depend()
|
||||
need localmount
|
||||
before logger
|
||||
after clock sysctl
|
||||
keyword -timeout
|
||||
keyword -prefix -timeout
|
||||
}
|
||||
|
||||
: ${wipe_tmp:=${WIPE_TMP:-yes}}
|
||||
|
@ -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()
|
||||
|
@ -10,7 +10,7 @@ depend() {
|
||||
need localmount
|
||||
after bootmisc
|
||||
before net.lo0
|
||||
keyword -jail
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
|
@ -6,7 +6,7 @@ description="Mount system critical filesystems in /dev."
|
||||
|
||||
depend() {
|
||||
use dev
|
||||
keyword -vserver
|
||||
keyword -prefix -vserver
|
||||
}
|
||||
|
||||
start() {
|
||||
|
@ -6,7 +6,7 @@ description="Configures a specific kernel dump device."
|
||||
|
||||
depend() {
|
||||
need swap
|
||||
keyword -jail
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start() {
|
||||
|
@ -9,7 +9,7 @@ _IFS="
|
||||
depend()
|
||||
{
|
||||
use dev clock modules
|
||||
keyword -jail -openvz -timeout -vserver -lxc
|
||||
keyword -jail -openvz -prefix -timeout -vserver -lxc
|
||||
}
|
||||
|
||||
_abort() {
|
||||
|
@ -9,7 +9,7 @@ depend()
|
||||
{
|
||||
use root
|
||||
before devd net
|
||||
keyword -jail
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
_set()
|
||||
|
@ -5,7 +5,7 @@
|
||||
description="Sets the hostname of the machine."
|
||||
|
||||
depend() {
|
||||
keyword -lxc
|
||||
keyword -prefix -lxc
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -28,7 +28,7 @@ depend()
|
||||
else
|
||||
before *
|
||||
fi
|
||||
keyword -openvz -uml -vserver -xenu -lxc
|
||||
keyword -openvz -prefix -uml -vserver -xenu -lxc
|
||||
}
|
||||
|
||||
setupopts()
|
||||
|
@ -8,7 +8,7 @@ depend()
|
||||
{
|
||||
need localmount termencoding
|
||||
after bootmisc
|
||||
keyword -openvz -uml -vserver -xenu -lxc
|
||||
keyword -openvz -prefix -uml -vserver -xenu -lxc
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -4,6 +4,11 @@
|
||||
|
||||
description="Kill all processes so we can unmount disks cleanly."
|
||||
|
||||
depend()
|
||||
{
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
ebegin "Terminating remaining processes"
|
||||
|
@ -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()
|
||||
|
@ -7,7 +7,7 @@ extra_commands="restore"
|
||||
depend()
|
||||
{
|
||||
need localmount
|
||||
keyword -jail
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
restore()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -16,7 +16,7 @@ depend()
|
||||
{
|
||||
need localmount
|
||||
after bootmisc
|
||||
keyword -jail
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -7,6 +7,7 @@ description="Update /etc/mtab to match what the kernel knows about"
|
||||
depend()
|
||||
{
|
||||
need root
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -23,7 +23,7 @@ depend()
|
||||
need sysfs
|
||||
fi
|
||||
after bootmisc
|
||||
keyword -jail -vserver
|
||||
keyword -jail -prefix -vserver
|
||||
|
||||
case "${IFACE}" in
|
||||
lo|lo0) provide lo;;
|
||||
|
@ -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()
|
||||
|
@ -13,7 +13,7 @@ depend()
|
||||
need localmount
|
||||
after bootmisc
|
||||
provide net
|
||||
keyword -jail -vserver
|
||||
keyword -jail -prefix -vserver
|
||||
}
|
||||
|
||||
uniqify()
|
||||
|
@ -7,6 +7,7 @@ required_files="/etc/newsyslog.conf"
|
||||
depend()
|
||||
{
|
||||
need localmount
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -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()
|
||||
|
@ -11,7 +11,7 @@ extra_started_commands="reload"
|
||||
|
||||
depend() {
|
||||
need localmount
|
||||
keyword -jail
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -12,7 +12,7 @@ depend()
|
||||
need localmount
|
||||
use logger
|
||||
after bootmisc
|
||||
keyword -jail
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start_pre()
|
||||
|
@ -8,7 +8,7 @@ depend()
|
||||
{
|
||||
use modules devfs
|
||||
need localmount
|
||||
keyword -openvz -vserver -lxc
|
||||
keyword -openvz -prefix -vserver -lxc
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -7,6 +7,7 @@ depend()
|
||||
need localmount net
|
||||
after *
|
||||
before local
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -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()
|
||||
|
@ -8,7 +8,7 @@ depend()
|
||||
{
|
||||
need dumpon localmount
|
||||
before encswap
|
||||
keyword -jail
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -12,7 +12,7 @@ depend()
|
||||
{
|
||||
provide net
|
||||
use network
|
||||
keyword -jail -vserver
|
||||
keyword -jail -prefix -vserver
|
||||
}
|
||||
|
||||
pre_flight_checks()
|
||||
|
@ -5,7 +5,7 @@
|
||||
depend()
|
||||
{
|
||||
before fsck
|
||||
keyword -jail
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -5,7 +5,7 @@
|
||||
depend()
|
||||
{
|
||||
before localmount
|
||||
keyword -jail -openvz -vserver -lxc
|
||||
keyword -jail -openvz -prefix -vserver -lxc
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -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
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
depend() {
|
||||
need localmount
|
||||
keyword -jail
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start() {
|
||||
|
@ -5,6 +5,7 @@
|
||||
depend()
|
||||
{
|
||||
before bootmisc logger
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -5,7 +5,7 @@
|
||||
depend()
|
||||
{
|
||||
before bootmisc logger
|
||||
keyword -lxc -vserver
|
||||
keyword -lxc -prefix -vserver
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -6,7 +6,7 @@ description="Mount the sys filesystem."
|
||||
|
||||
depend()
|
||||
{
|
||||
keyword -vserver
|
||||
keyword -prefix -vserver
|
||||
}
|
||||
|
||||
mount_sys()
|
||||
|
@ -16,4 +16,5 @@ depend()
|
||||
use net newsyslog
|
||||
need localmount
|
||||
after bootmisc
|
||||
keyword -prefix
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
depend()
|
||||
{
|
||||
after fsck
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -8,7 +8,7 @@ description="Initializes the random number generator."
|
||||
depend()
|
||||
{
|
||||
need localmount
|
||||
keyword -jail -openvz
|
||||
keyword -jail -openvz -prefix
|
||||
}
|
||||
|
||||
save_seed()
|
||||
|
@ -5,6 +5,7 @@
|
||||
depend()
|
||||
{
|
||||
need localmount
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user