include $(top_srcdir)/ensc_fmt/Makefile-files
include $(top_srcdir)/lib_internal/Makefile-files
include $(top_srcdir)/vserver-start/Makefile-files
+include $(top_srcdir)/gentoo/Makefile-files
include $(top_srcdir)/m4/gpgsig.am
include $(top_srcdir)/m4/validate.am
dnl ########################
+dnl Check what distro this is, use Gentoo initscripts if appropriate
+AC_MSG_CHECKING([for host initscripts])
+AC_ARG_WITH(initscripts, [force host initscripts (valid values are: gentoo, sysv)], [
+ case "$withval" in
+ gentoo) ensc_with_init=gentoo;;
+ sysv) ensc_with_init=sysv;;
+ *) AC_MSG_ERROR([invalid initscripts value, only gentoo and sysv are supported]);;
+ esac
+ ], [
+ if test -e /etc/gentoo-release; then
+ ensc_with_init=gentoo
+ else
+ ensc_with_init=sysv
+ fi
+ ])
+AC_MSG_RESULT([$ensc_with_init])
+AM_CONDITIONAL(HAVE_GENTOO_INIT, test x"$ensc_with_init" = xgentoo)
+AM_CONDITIONAL(HAVE_SYSV_INIT, test x"$ensc_with_init" = xsysv)
+
+
dnl BIG HACK! Do some autodetection here!
AC_DEFINE(UTMP_GID, [22], [The utmp gid-number])
--- /dev/null
+## $Id$ -*- makefile -*-
+
+## Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+##
+
+AM_INSTALLCHECK_STD_OPTIONS_EXEMPT += \
+ $(gentoo_src_SCRPTS)
+
+gentoo_src_SCRPTS = gentoo/vprocunhide \
+ gentoo/vservers.default \
+ gentoo/util-vserver
+
+EXTRA_DIST += $(gentoo_src_SCRPTS)
+
+if HAVE_GENTOO_INIT
+initrd_SCRIPTS += $(gentoo_src_SCRPTS)
+endif
--- /dev/null
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+set_helper() {
+ local f="/proc/sys/kernel/vshelper"
+ if [ -e "$f" ]; then
+ echo "$_VSHELPER" > "$f"
+ fi
+ return 0
+}
+
+kill_contexts() {
+ local xid
+ for xid in `ls -1 /proc/virtual`; do
+ [ "$xid" = "info" -o "$xid" = "status" ] && continue
+ $_VATTRIBUTE --xid $xid --set --flag ~persistent
+ $_VKILL --xid $xid -s 15
+ sleep 3
+ $_VKILL --xid $xid -s 9
+ done
+ local alive=0
+ for xid in `ls -1 /proc/virtual`; do
+ [ "$xid" = "info" -o "$xid" = "status" ] && continue
+ let alive+=1
+ done
+ return $alive
+}
+
+start() {
+ : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
+ if [[ ! -e ${UTIL_VSERVER_VARS} ]]; then
+ eerror "Cannot find util-vserver installation"
+ eerror "(the file '$UTIL_VSERVER_VARS' would be expected)"
+ return 1
+ fi
+
+ source ${UTIL_VSERVER_VARS}
+ source "$_LIB_FUNCTIONS"
+ source "$__PKGLIBDIR/vserver.functions"
+
+ ebegin "Setting path to vshelper"
+ set_helper
+ eend $?
+
+ ebegin "Loading default device map"
+ loadDeviceMap 0 "$__CONFDIR/.defaults/apps/vdevmap"
+ eend $?
+}
+
+stop() {
+ : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
+ if [[ ! -e ${UTIL_VSERVER_VARS} ]]; then
+ eerror "Cannot find util-vserver installation"
+ eerror "(the file '$UTIL_VSERVER_VARS' would be expected)"
+ return 1
+ fi
+
+ source ${UTIL_VSERVER_VARS}
+ source "$_LIB_FUNCTIONS"
+ source "$__PKGLIBDIR/vserver.functions"
+
+ ebegin "Stopping all running guests"
+ $_START_VSERVERS -j 1 --all --stop
+ eend $?
+
+ ebegin "Killing all running contexts"
+ kill_contexts
+ eend $?
+}
+
+# vim:ts=4:filetype=gentoo-init-d
--- /dev/null
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+start() {
+ : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
+ if [[ ! -e ${UTIL_VSERVER_VARS} ]]; then
+ eerror "Cannot find util-vserver installation"
+ eerror "(the file '$UTIL_VSERVER_VARS' would be expected)"
+ return 1
+ fi
+
+ source ${UTIL_VSERVER_VARS}
+
+ ebegin "Fixing /proc entries visibility"
+ ${_VPROCUNHIDE}
+ eend $?
+}
+
+# vim:ts=4:filetype=gentoo-init-d
--- /dev/null
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need util-vserver vprocunhide
+}
+
+start() {
+ MARK=${SVCNAME#vservers.} /usr/lib/util-vserver/vserver-wrapper start
+}
+
+stop() {
+ MARK=${SVCNAME#vservers.} /usr/lib/util-vserver/vserver-wrapper stop
+}
+
+
+
+# vim:ts=4:filetype=gentoo-init-d
%build
%configure --with-initrddir=%_initrddir --enable-release \
%{?_without_dietlibc:--disable-dietlibc} \
- %{?_with_legacy:--enable-apis=NOLEGACY}
+ %{?_with_legacy:--enable-apis=NOLEGACY} \
+ --with-initscripts=sysv
%__make %{?_smp_mflags} all
%{!?_without_doc:%__make %{?_smp_mflags} doc}