# -*-shell-*-
# $Id$
+#shopt -s huponexit
+
COMMAND=$(basename $0)
DIRNAME=$(dirname $0)
# pkgs parsing utilities
PATH=$(dirname $0):$PATH . build.common
-DEFAULT_FCDISTRO=centos5
+DEFAULT_FCDISTRO=f8
DEFAULT_PLDISTRO=planetlab
DEFAULT_PERSONALITY=linux32
DEFAULT_IFNAME=eth0
vserver=$1; shift
fcdistro=$1; shift
- pushd /etc/vservers/.distributions/${fcdistro}
- if [ -f yum/yum.conf ] ; then
- echo "Initializing yum.conf in $vserver from $(pwd)/yum"
+ templates=/etc/vservers/.distributions/${fcdistro}
+ if [ -f ${templates}/yum/yum.conf ] ; then
+ echo "Initializing yum.conf in $vserver from ${templates}/yum"
sed -e "s!@YUMETCDIR@!/etc!g;
s!@YUMCACHEDIR@!/var/cache/yum!g;
s!@YUMLOGDIR@!/var/log!g;
s!@YUMLOCKDIR@!/var/lock!g;
- " yum/yum.conf > /vservers/$vserver/etc/yum.conf
+ " ${templates}/yum/yum.conf > /vservers/$vserver/etc/yum.conf
# post process the various @...@ variables from this yum.conf file.
else
echo "Using $fcdistro default for yum.conf"
fi
- if [ -d yum.repos.d ] ; then
- echo "Initializing yum.repos.d in $vserver from $(pwd)/yum.repos.d"
+ if [ -d ${templates}/yum.repos.d ] ; then
+ echo "Initializing yum.repos.d in $vserver from ${templates}/yum.repos.d"
rm -rf /vservers/$vserver/etc/yum.repos.d
- tar cf - yum.repos.d | tar -C /vservers/$vserver/etc -xvf -
+ tar -C ${templates} -cf - yum.repos.d | tar -C /vservers/$vserver/etc -xvf -
else
echo "Cannot initialize yum.repos.d in $vserver"
fi
EOF
fi
fi
- popd
}
# return yum or debootstrap
fi
# start the vserver so we can do the following operations
+# rm -f /tmp/go*
+# echo -n ' about to start - WAITING for /tmp/go1' ; while true ; do [ -f /tmp/go1 ] && break || : ; done
$personality vserver $VERBOSE $vserver start
+# echo -n ' started - WAITING for /tmp/go2' ; while true ; do [ -f /tmp/go2 ] && break || : ; done
+#if true ; then
+# echo SKIPPING for debug --- vserver was started
+#else
[ "$pkg_method" = "yum" ] && $personality vserver $VERBOSE $vserver exec sh -c "rm -f /var/lib/rpm/__db*"
[ "$pkg_method" = "yum" ] && $personality vserver $VERBOSE $vserver exec rpm --rebuilddb
- # with vserver 2.3, granting the vserver CAP_MKNOD is not enough
- # check whether we run vs2.3 or above
- vs_version=$(uname -a | sed -e 's,.*[\.\-]vs\([0-9]\)\.\([0-9]\)\..*,\1\2,')
- # at this stage we have here 22 or 23
- need_vdevmap=$(( $vs_version >= 23 ))
+ # check if the vserver kernel is using VSERVER_DEVICE (vdevmap) support
+ need_vdevmap=$(grep "CONFIG_VSERVER_DEVICE=y" /boot/config-$(uname -r) | wc -l)
- if [ "$need_vdevmap" == 1 ] ; then
+ if [ $need_vdevmap -eq 1 ] ; then
ctx=$(cat /etc/vservers/$vserver/context)
vdevmap --set --xid $ctx --open --create --target /dev/null
vdevmap --set --xid $ctx --open --create --target /dev/root
cp /etc/resolv.conf /vservers/$vserver/etc/resolv.conf
# and /etc/hosts for at least localhost
[ -f /vservers/$vserver/etc/hosts ] || echo "127.0.0.1 localhost localhost.localdomain" > /vservers/$vserver/etc/hosts
+
+#fi
+
}
function devel_or_vtest_tools () {
# turn off regular crond, as plc invokes plc_crond
chkconfig crond off
+ # take care of loginuid in /etc/pam.d
+ sed -i "s,#*\(.*loginuid.*\),#\1," /etc/pam.d/*
+
# customize root's prompt
cat << PROFILE > /root/.profile
export PS1="[$vserver] \\w # "