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 else
before * before *
fi fi
keyword noprefix nouml novps noxenu keyword noopenvz noprefix nouml novserver noxenu
} }
setupopts() setupopts()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@ sync; sync
# If we are in a VPS, we don't need anything below here, because # 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 # 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) # 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 if [ -e /etc/init.d/"$1".sh ]; then
. /etc/init.d/"$1".sh . /etc/init.d/"$1".sh
else else

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -207,8 +207,11 @@ const char *rc_sys (void)
} else if (file_regex ("/proc/cpuinfo", "UML")) } else if (file_regex ("/proc/cpuinfo", "UML"))
return (RC_SYS_UML); return (RC_SYS_UML);
else if (file_regex ("/proc/self/status", else if (file_regex ("/proc/self/status",
"(s_context|VxID|envID):[[:space:]]*[1-9]")) "(s_context|VxID):[[:space:]]*[1-9]"))
return (RC_SYS_VPS); return (RC_SYS_VSERVER);
else if (file_regex ("/proc/self/status",
"envID:[[:space:]]*[1-9]"))
return (RC_SYS_OPENVZ);
#endif #endif
return (NULL); 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. * OpenRC can support some special sub system types, normally virtualization.
* Some services cannot work in these systems, or we do something else. */ * Some services cannot work in these systems, or we do something else. */
#define RC_SYS_JAIL "JAIL" #define RC_SYS_JAIL "JAIL"
#define RC_SYS_OPENVZ "OPENVZ"
#define RC_SYS_PREFIX "PREFIX" #define RC_SYS_PREFIX "PREFIX"
#define RC_SYS_UML "UML" #define RC_SYS_UML "UML"
#define RC_SYS_VPS "VPS" #define RC_SYS_VSERVER "VSERVER"
#define RC_SYS_XEN0 "XEN0" #define RC_SYS_XEN0 "XEN0"
#define RC_SYS_XENU "XENU" #define RC_SYS_XENU "XENU"
const char *rc_sys (void); const char *rc_sys (void);

View File

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