From: Benedikt Boehm Date: Fri, 15 Sep 2006 19:16:48 +0000 (+0000) Subject: add gentoo distribution target; force sane /dev by default for template build method X-Git-Tag: release-0.30.211~40 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7524644f70b0b0c4fba7f11b7e9ad3fb1c783da;p=util-vserver.git add gentoo distribution target; force sane /dev by default for template build method git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2315 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/distrib/Makefile.am b/distrib/Makefile.am index 4d1dc26..42953af 100644 --- a/distrib/Makefile.am +++ b/distrib/Makefile.am @@ -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 index 0000000..66e0f20 --- /dev/null +++ b/distrib/gentoo/initpost @@ -0,0 +1,28 @@ +#! /bin/bash + +# Copyright (C) 2005 Enrico Scholz +# +# 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 + +. "$2" + +$_MKDIR -p "$1"/vdir/usr/portage + +$_CAT <> "$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 diff --git a/scripts/vserver-build.functions b/scripts/vserver-build.functions index 7baae59..1c96613 100644 --- a/scripts/vserver-build.functions +++ b/scripts/vserver-build.functions @@ -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 \ diff --git a/scripts/vserver-build.template b/scripts/vserver-build.template index 7274dcd..b56a3e4 100644 --- a/scripts/vserver-build.template +++ b/scripts/vserver-build.template @@ -1,4 +1,4 @@ -# $Id:$ --*- sh -*-- +# $Id$ --*- sh -*-- # Copyright (C) 2006 Enrico Scholz # @@ -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