Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Commit

Permalink
add openrc support for gentoo
Browse files Browse the repository at this point in the history
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
  • Loading branch information
udeved authored and hallyn committed Oct 23, 2015
1 parent d334501 commit 8123170
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/init/Makefile.am
@@ -1 +1 @@
SUBDIRS = bsd systemd sysvinit upstart
SUBDIRS = bsd systemd sysvinit upstart openrc
18 changes: 18 additions & 0 deletions config/init/openrc/Makefile.am
@@ -0,0 +1,18 @@
EXTRA_DIST = cgmanager cgproxy

if INIT_SCRIPT_OPENRC
RC_INIT_DIR = $(sysconfdir)/init.d

install-openrc: cgmanager cgproxy
$(MKDIR_P) $(DESTDIR)$(RC_INIT_DIR)
$(INSTALL_DATA) cgmanager $(DESTDIR)$(RC_INIT_DIR)/
$(INSTALL_DATA) cgproxy $(DESTDIR)$(RC_INIT_DIR)/

uninstall-openrc:
rm -f $(DESTDIR)$(RC_INIT_DIR)/cgmanager
rm -f $(DESTDIR)$(RC_INIT_DIR)/cgroxy
rmdir $(DESTDIR)$(RC_INIT_DIR) || :

install-data-local: install-openrc
uninstall-local: uninstall-openrc
endif
15 changes: 15 additions & 0 deletions config/init/openrc/cgmanager
@@ -0,0 +1,15 @@
#!/sbin/openrc-run
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

description="Control Group manager daemon"
pidfile="/run/cgmanager.pid"
command="/usr/sbin/cgmanager"
command_args="-m name=systemd"
command_background="yes"
retry="TERM/45"

depend() {
before cgproxy
}
28 changes: 28 additions & 0 deletions config/init/openrc/cgproxy
@@ -0,0 +1,28 @@
#!/sbin/openrc-run
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

description="Control Group manager proxy"
pidfile="/run/cgproxy.pid"
command="/usr/sbin/cgproxy"
command_args="--daemon"
command_background="yes"
retry="TERM/45"
NESTED="${NESTED:-no}"

depend() {
after cgmanager
}

start_pre() {
if ! /usr/sbin/cgproxy --check-master; then
ewarn "cgmanager is not running"
return 1
fi
# cgproxy should only run on container unless on older kernel
if [ -e /proc/self/ns/pid ] && [ "$NESTED" != "yes" ]; then
eerror "Too old kernel to support cgroup, please update to >3.8"
return 1
fi
}
9 changes: 7 additions & 2 deletions configure.ac
Expand Up @@ -12,6 +12,7 @@ AC_CONFIG_FILES([
config/Makefile
config/init/Makefile
config/init/bsd/Makefile
config/init/openrc/Makefile
config/init/systemd/Makefile
config/init/sysvinit/Makefile
config/init/upstart/Makefile
Expand Down Expand Up @@ -78,7 +79,7 @@ AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
AC_MSG_CHECKING([for init system type])
AC_ARG_WITH([init-script],
[AC_HELP_STRING([--with-init-script@<:@=TYPE@<:@,TYPE,...@:>@@:>@],
[Type(s) of init script to install: bsd, sysvinit, systemd, upstart,
[Type(s) of init script to install: bsd, openrc, sysvinit, systemd, upstart,
distro @<:@default=distro@:>@])],[],[with_init_script=distro])
case "$with_init_script" in
distro)
Expand All @@ -98,6 +99,9 @@ case "$with_init_script" in
slackware)
init_script=bsd
;;
gentoo)
init_script=openrc
;;
*)
echo -n "Linux distribution init system unknown."
init_script=
Expand All @@ -113,7 +117,7 @@ esac
(IFS="," ; for init_sys in $init_script;
do
case "$init_sys" in
none|bsd|sysvinit|systemd|upstart)
none|bsd|openrc|sysvinit|systemd|upstart)
;;
*)
exit 1
Expand All @@ -122,6 +126,7 @@ do
done) || AC_MSG_ERROR([Unknown init system type in $init_script])

AM_CONDITIONAL([INIT_SCRIPT_BSD], [echo "$init_script" |grep -q "bsd"])
AM_CONDITIONAL([INIT_SCRIPT_OPENRC], [echo "$init_script" |grep -q "openrc"])
AM_CONDITIONAL([INIT_SCRIPT_SYSV], [echo "$init_script" |grep -q "sysvinit"])
AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], [echo "$init_script" |grep -q "systemd"])
AM_CONDITIONAL([INIT_SCRIPT_UPSTART], [echo "$init_script" |grep -q "upstart"])
Expand Down

0 comments on commit 8123170

Please sign in to comment.