add gentoo distribution target; force sane /dev by default for template build method
authorBenedikt Boehm <hollow@gentoo.org>
Fri, 15 Sep 2006 19:16:48 +0000 (19:16 +0000)
committerBenedikt Boehm <hollow@gentoo.org>
Fri, 15 Sep 2006 19:16:48 +0000 (19:16 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2315 94cd875c-1c1d-0410-91d2-eb244daf1a30

distrib/Makefile.am
distrib/gentoo/initpost [new file with mode: 0755]
scripts/vserver-build.functions
scripts/vserver-build.template

index 4d1dc26..42953af 100644 (file)
@@ -30,7 +30,8 @@ defaults_DATA =               misc/debootstrap.uri \
 
 nobase_distrib_SCRIPTS =  redhat/initpost \
                           redhat/initpre \
-                          redhat/rc.sysinit
+                          redhat/rc.sysinit \
+                          gentoo/initpost
 
 nobase_distrib_DATA    =  defaults/devs \
                           defaults/apt.conf \
diff --git a/distrib/gentoo/initpost b/distrib/gentoo/initpost
new file mode 100755 (executable)
index 0000000..66e0f20
--- /dev/null
@@ -0,0 +1,28 @@
+#! /bin/bash
+
+# Copyright (C) 2005 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; 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>
+
+. "$2"
+
+$_MKDIR -p "$1"/vdir/usr/portage
+
+$_CAT <<EOF >> "$1"/fstab
+# shared portage tree
+/usr/portage           /usr/portage           none bind,ro 0 0
+/usr/portage/distfiles /usr/portage/distfiles none bind,rw 0 0
+EOF
index 7baae59..1c96613 100644 (file)
@@ -50,6 +50,17 @@ function makeDevEntry
     esac
 }
 
+function populateDev
+{
+    local spec
+
+    mkdir -p -m755 "$VDIR"/dev/pts
+
+    while read spec; do
+       makeDevEntry "$VDIR"/dev $spec
+    done <$_DEV_FILE
+}
+
 function populateDirectory
 {
     local dst=$1
@@ -191,16 +202,13 @@ exist already; please try to use '--force', or remove them manually."
     $_SETATTR --~barrier "$VDIR"
     base._addGeneratedFile "$VDIR"
     
-    mkdir -p -m755 "$SETUP_CONFDIR"/apps "$VDIR"/{dev/pts,etc}
+    mkdir -p -m755 "$SETUP_CONFDIR"/apps "$VDIR"/etc
     base._addGeneratedFile "$SETUP_CONFDIR"
     
     ln -s "$VDIR"                     "$SETUP_CONFDIR/vdir"
     ln -s "$CACHEDIR/$VSERVERDIRNAME" "$SETUP_CONFDIR/cache"
 
-    local spec
-    while read spec; do
-       makeDevEntry "$VDIR"/dev $spec
-    done <$_DEV_FILE
+    populateDev
 
     mkdir -p "$VDIR"/proc
     findAndCopy "$VDIR"/etc/hosts         "$__CONFDIR"/.defaults/files/hosts "$__CONFDIR/.distributions/$DISTRIBUTION"/files/hosts \
index 7274dcd..b56a3e4 100644 (file)
@@ -1,4 +1,4 @@
-# $Id:$        --*- sh -*--
+# $Id$ --*- sh -*--
 
 # Copyright (C) 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
 #  
@@ -22,12 +22,14 @@ eval set -- "$tmp"
 
 DISTRIBUTION=:
 use_pkgmgmt=
+no_dev_sanity=
 declare -a TEMPLATE=()
 while true; do
     case "$1" in
        -d)             DISTRIBUTION=$2; shift;;
        --debug)        set -x;;
        --pkgmgmt)      use_pkgmgmt=1;;
+       --nodevsanity)  no_dev_sanity=1;;
        -t|--template)
                        case "$2" in
                             /*)        f="$2";;
@@ -87,6 +89,11 @@ for t in "${TEMPLATE[@]}"; do
 done
 popd &> /dev/null
 
+test -z "$no_dev_sanity" || {
+    rm -rf dev/*
+    populateDev
+}
+
 test -z "$BUILD_INITPOST" || "$BUILD_INITPOST" "$SETUP_CONFDIR" "$UTIL_VSERVER_VARS"
 
 base.setSuccess