Split VPS into VSERVER and OPENVZ

This commit is contained in:
Roy Marples 2008-03-03 17:19:56 +00:00
parent f3e90dddbf
commit 15cf41e713
20 changed files with 36 additions and 29 deletions

View File

@ -28,7 +28,7 @@ depend()
else
before *
fi
keyword noprefix nouml novps noxenu
keyword noopenvz noprefix nouml novserver noxenu
}
setupopts()

View File

@ -9,7 +9,7 @@ depend()
need localmount
need keymaps # sets up terminal encoding scheme
after hotplug
keyword noprefix nouml novps noxenu
keyword noopenvz noprefix nouml novserver noxenu
}
start()

View File

@ -15,7 +15,7 @@ dumpkeys_charset=${dumpkeys_charset:-${DUMPKEYS_CHARSET}}
depend()
{
need localmount
keyword noprefix nouml novps noxenu
keyword noopenvz noprefix nouml novserver noxenu
}
start()

View File

@ -7,7 +7,7 @@ description="Loads a user defined list of kernel modules."
depend()
{
use isapnp
keyword noprefix novps
keyword noopenvz noprefix novserver
}
start()

View File

@ -9,7 +9,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER}:-12}
depend()
{
need localmount
keyword noprefix
keyword noopenvz noprefix novserver
}
_setleds()

View File

@ -7,7 +7,7 @@ description="Mounts misc filesystems in /proc."
depend()
{
need localmount
keyword noprefix
keyword noopenvz noprefix novserver
}
start()

View File

@ -6,7 +6,7 @@ depend()
{
use hostname
before bootmisc logger
keyword noprefix novps
keyword noopenvz noprefix novserver
}
start()

View File

@ -113,7 +113,7 @@ start()
[ -x /sbin/restorecon ] && restorecon /tmp/.ICE-unix /tmp/.X11-unix
# Create an 'after-boot' dmesg log
if [ "${RC_SYS}" != "VPS" ]; then
if [ "${RC_SYS}" != "VSERVER" -a "${RC_SYS}" != "OPENVZ" ]; then
dmesg > /var/log/dmesg
chmod 640 /var/log/dmesg
fi

View File

@ -9,7 +9,7 @@ _ISF="
depend()
{
after clock modules
keyword nojail noprefix notimeout
keyword nojail noopenvz noprefix notimeout novserver
}
_abort() {

View File

@ -27,7 +27,7 @@ sync; sync
# If we are in a VPS, we don't need anything below here, because
# 1) we don't need (and by default can't) umount anything (VServer) or
# 2) the host utils take care of all umounting stuff (OpenVZ)
if [ "${RC_SYS}" = "VPS" ]; then
if [ "${RC_SYS}" = "VSERVER" -o "${RC_SYS}" = "OPENVZ" ]; then
if [ -e /etc/init.d/"$1".sh ]; then
. /etc/init.d/"$1".sh
else

View File

@ -8,7 +8,7 @@ depend()
{
need fsck
use modules mtab
keyword nojail noprefix
keyword nojail noopenvz noprefix novserver
}
start()
@ -29,9 +29,6 @@ start()
stop()
{
# Don't unmount anything for VPS systems
[ "${RC_SYS}" = "VPS" ] && return 0
# We never unmount / or /dev or $RC_SVCDIR
local x= no_umounts="/|/dev|/dev/.*|${RC_SVCDIR}"

View File

@ -34,7 +34,7 @@ depend()
config /etc/fstab
need net ${pmap}
use afc-client amd autofs dns nfs nfsmount portmap rpcbind rpc.statd
keyword nojail noprefix
keyword nojail noopenvz noprefix novserver
}
start()

View File

@ -7,7 +7,7 @@ description="Mount the root fs read/write"
depend()
{
need fsck
keyword nojail noprefix
keyword nojail noopenvz noprefix novserver
}
start()

View File

@ -5,7 +5,7 @@
depend()
{
need localmount
keyword nojail noprefix
keyword nojail noopenvz noprefix novserver
}
start()

View File

@ -137,12 +137,14 @@ Tags a service with a keyword. Here's the keywords we currently understand:-
.It Dv nojail
When in a jail, exclude this service from any dependencies. The service can
still be run directly.
.It Dv noopenvz
Same as nojail, but for OpenVZ systems.
.It Dv notimeout
Do not time out waiting for that service.
.It Dv nouml
Same as nojail, but for UML systems.
.It Dv novps
Same as nojail, but for VServer and OpenVZ systems.
.It Dv novserver
Same as nojail, but for VServer systems.
.It Dv noxen0
Same as nojail, but for Xen DOM0 systems.
.It Dv noxenu
@ -284,7 +286,7 @@ Boot runlevel chosen. Default is boot.
Default runlevel chosen. Default is default.
.It Va RC_SYS
A special variable to describe the system more.
Possible values are XENU, XEN0, UML and VPS.
Possible values are OPENVZ, XENU, XEN0, UML and VSERVER.
.It Va RC_UNAME
The result of `uname -s`.
.El

View File

@ -65,7 +65,7 @@ mount_svcdir()
# Set the console loglevel to 1 for a cleaner boot
# the logger should anyhow dump the ring-0 buffer at start to the
# logs, and that with dmesg can be used to check for problems
if [ -n "${dmesg_level}" -a "${RC_SYS}" != "VPS" ]; then
if [ -n "${dmesg_level}" -a "${RC_SYS}" != "VSERVER" ]; then
dmesg -n "${dmesg_level}"
fi
@ -108,7 +108,10 @@ if [ -r /sbin/livecd-functions.sh ]; then
livecd_read_commandline
fi
if [ "${RC_UNAME}" != "GNU/kFreeBSD" -a "${RC_SYS}" != "VPS" ]; then
if [ "${RC_UNAME}" != "GNU/kFreeBSD" \
-a "${RC_SYS}" != "VSERVER" \
-a "${RC_SYS}" != "OPENVZ" ]
then
if grep -Eq "[[:space:]]+sysfs$" /proc/filesystems; then
if [ -d /sys ]; then
if ! mountinfo --quiet /sys; then
@ -128,7 +131,8 @@ fi
# Try to figure out how the user wants /dev handled
if [ "${rc_devices}" = "static" \
-o "${RC_SYS}" = "VPS" \
-o "${RC_SYS}" = "VSERVER" \
-o "${RC_SYS}" = "OPENVZ" \
-o "${RC_UNAME}" = "GNU/kFreeBSD" ]
then
ebegin "Using existing device nodes in /dev"

View File

@ -21,7 +21,7 @@ depend()
need localmount
after bootmisc
provide net
keyword nojail noprefix
keyword nojail noprefix novserver
case "${IFACE}" in
lo|lo0);;

View File

@ -207,8 +207,11 @@ const char *rc_sys (void)
} else if (file_regex ("/proc/cpuinfo", "UML"))
return (RC_SYS_UML);
else if (file_regex ("/proc/self/status",
"(s_context|VxID|envID):[[:space:]]*[1-9]"))
return (RC_SYS_VPS);
"(s_context|VxID):[[:space:]]*[1-9]"))
return (RC_SYS_VSERVER);
else if (file_regex ("/proc/self/status",
"envID:[[:space:]]*[1-9]"))
return (RC_SYS_OPENVZ);
#endif
return (NULL);

View File

@ -232,9 +232,10 @@ bool rc_service_daemons_crashed (const char *service);
* OpenRC can support some special sub system types, normally virtualization.
* Some services cannot work in these systems, or we do something else. */
#define RC_SYS_JAIL "JAIL"
#define RC_SYS_OPENVZ "OPENVZ"
#define RC_SYS_PREFIX "PREFIX"
#define RC_SYS_UML "UML"
#define RC_SYS_VPS "VPS"
#define RC_SYS_VSERVER "VSERVER"
#define RC_SYS_XEN0 "XEN0"
#define RC_SYS_XENU "XENU"
const char *rc_sys (void);

View File

@ -289,8 +289,8 @@ static void sulogin (bool cont)
#ifdef __linux__
char *e = getenv ("RC_SYS");
/* VPS systems cannot do a sulogin */
if (e && strcmp (e, "VPS") == 0) {
/* VSERVER and OPENVZ systems cannot do a sulogin */
if (e && (strcmp (e, "VSERVER") == 0 || strcmp (e, "OPENVZ") == 0) {
execl ("/sbin/halt", "/sbin/halt", "-f", (char *) NULL);
eerrorx ("%s: unable to exec `/sbin/halt': %s", applet, strerror (errno));
}