X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=distrib%2Fetch%2Finitpost;fp=distrib%2Fetch%2Finitpost;h=bd6e698051f39ce5d7960fb488c3fd2a2cc261e4;hb=9234e6a7cb48373edec38284ba54a819037b79b2;hp=0000000000000000000000000000000000000000;hpb=5a7d89b238734a86c5da88766305c5483098d599;p=util-vserver.git diff --git a/distrib/etch/initpost b/distrib/etch/initpost new file mode 100755 index 0000000..bd6e698 --- /dev/null +++ b/distrib/etch/initpost @@ -0,0 +1,130 @@ +#!/bin/bash + +# Copyright (C) 2006 Benedikt Boehm +# +# 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 + +# setup environment +cfgdir="$1" +vdir="$cfgdir"/vdir +. "$2" + + +# vserver name +NAME=$(< "$cfgdir"/name) + +# debian mirror +MIRROR=$3 + +# debian distribution +DIST="etch" + + +# go to vdir for chroot-sh +pushd "$vdir" &>/dev/null + + +# helper for sed in chroot +chrootsed() { + local file="$1" + shift + + sedtmp=$($_MKTEMP chrootsed.XXXXXX) + + $_CHROOT_SH cat "$file" | $_SED "$@" > $sedtmp + $_CHROOT_SH truncate "$file" < $sedtmp + + $_RM -f $sedtmp +} + + +# create a locale.gen if needed. +if test -n "$LANG" && test "$LANG" != "C"; then + echo $LANG $(locale charmap) | $_CHROOT_SH append /etc/locale.gen +fi + + +# make apt and friends work +$_CHROOT_SH truncate /etc/apt/sources.list <>> Executing post install script ... " +echo + +# start vserver before we can exec anything inside it +vserver $NAME start + +# run the configure commands from within the server +vserver $NAME exec /vserver-config.sh +$_CHROOT_SH rm /vserver-config.sh + +# stop the vserver +vserver $NAME stop + +popd &>/dev/null