This commit was generated by cvs2svn to compensate for changes in r2562,
[util-vserver.git] / distrib / gentoo / initpre
diff --git a/distrib/gentoo/initpre b/distrib/gentoo/initpre
new file mode 100755 (executable)
index 0000000..24ffd80
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# Copyright (C) 2006 Benedikt Boehm <hollow@gentoo.org>
+#  
+# 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; version 2 of the License.
+#  
+# 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.
+
+## Called as: initpost <cfgdir> <path of util-vserver-vars>
+
+vdir="$1"/vdir
+. "$2"
+
+# portage stuff
+
+echo ">>> Adding shared /usr/portage to fstab ... "
+
+if test -d /usr/portage; then
+       ( echo
+         echo "# shared portage tree"
+         echo "/usr/portage           /usr/portage           none bind,ro 0 0"
+         echo "/usr/portage/distfiles /usr/portage/distfiles none bind,rw 0 0"
+       ) >> "$1"/fstab
+else
+       echo "!!! Cannot find /usr/portage! You should definitely use a"
+       echo "!!! shared portage tree if you have multiple Gentoo guests!"
+fi
+
+
+# initstyle sanity
+initstyle=sysv
+test -e "$1"/apps/init/style && initstyle=$(<"$1"/apps/init/style)
+
+echo ">>> Checking init-style ... $initstyle"
+
+if test "$initstyle" != "gentoo" -a "$initstyle" != "plain"; then
+       echo "!!! The init-style you specified is not supported for Gentoo"
+       echo "!!! Please use one of: plain, gentoo"
+fi