# pkgs parsing utilities
PATH=$(dirname $0):$PATH . build.common
-DEFAULT_FCDISTRO=f7
+DEFAULT_FCDISTRO=f8
DEFAULT_PLDISTRO=planetlab
DEFAULT_PERSONALITY=linux32
else
# exclude kernel from fedora repos
for i in /vservers/$vserver/etc/yum.repos.d/* ; do
- echo "exclude=kernel* ulogd iptables" >> $i
+ [ -f $i ] && echo "exclude=kernel* ulogd iptables" >> $i
done
# the build repo is not signed at this stage
cat > /vservers/$vserver/etc/yum.repos.d/myplc.repo <<EOF
fi
# create it
- $personality vserver $VERBOSE $vserver build $VSERVER_OPTIONS -m yum -- -d $fcdistro
+ # try to work around the vserver issue:
+ # vc_ctx_migrate: No such process
+ # rpm-fake.so: failed to initialize communication with resolver
+ for i in 1 2 3 4 5 ; do
+ $personality vserver $VERBOSE $vserver build $VSERVER_OPTIONS -m yum -- -d $fcdistro && break || true
+ echo "Waiting for one minute"
+ sleep 60
+ done
+ # check success
+ [ -d /vservers/$vserver ]
if [ ! -z "$personality" ] ; then
registered_personality=$(grep $personality /etc/vservers/$vserver/personality | wc -l)
fi
if [ -n "$VBUILD_MODE" ] ; then
- # set up appropriate vserver capabilities to mount, mknod and IPC_LOCK
+ ### capabilities required for a build vserver
+ # set up appropriate vserver capabilities to mount, mknod and IPC_LOCK
BCAPFILE=/etc/vservers/$vserver/bcapabilities
touch $BCAPFILE
cap=$(grep ^CAP_SYS_ADMIN /etc/vservers/$vserver/bcapabilities | wc -l)
[ $cap -eq 0 ] && echo 'CAP_MKNOD' >> /etc/vservers/$vserver/bcapabilities
cap=$(grep ^CAP_IPC_LOCK /etc/vservers/$vserver/bcapabilities | wc -l)
[ $cap -eq 0 ] && echo 'CAP_IPC_LOCK' >> /etc/vservers/$vserver/bcapabilities
+ else
+ ### capabilities required for a myplc vserver
+ # for /etc/plc.d/gpg - need to init /dev/random
+ cap=$(grep ^CAP_MKNOD /etc/vservers/$vserver/bcapabilities | wc -l)
+ [ $cap -eq 0 ] && echo 'CAP_MKNOD' >> /etc/vservers/$vserver/bcapabilities
fi
$personality vyum $vserver -- -y install yum
# start the vserver so we can do the following operations
$personality vserver $VERBOSE $vserver start
- $personality vserver $VERBOSE $vserver exec rm -f /var/lib/rpm/__db*
+ $personality vserver $VERBOSE $vserver exec sh -c "rm -f /var/lib/rpm/__db*"
$personality vserver $VERBOSE $vserver exec rpm --rebuilddb
# minimal config in the vserver for yum to work
if [ -n "$VBUILD_MODE" ] ; then
pkgsname=devel.pkgs
else
- pkgsname=native-shell.pkgs
+ pkgsname=vtest.pkgs
fi
- pkgsfile=$(pl_locateDistroFile $(DIRNAME) $pldistro $pkgsname)
+ pkgsfile=$(pl_locateDistroFile $DIRNAME $pldistro $pkgsname)
# install individual packages, then groups
packages=$(pl_getPackages ${fcdistro} $pkgsfile)
}
COMMAND_VBUILD="vbuild-init-vserver.sh"
-COMMAND_MYPLC="myplc-init-vserver.sh"
+COMMAND_MYPLC="vtest-init-vserver.sh"
function usage () {
set +x
- echo "Usage: $COMMAND_VBUILD [-v] vserver-name [ -- vserver-options ]"
- echo "Usage: $COMMAND_MYPLC [-v] vserver-name repo-url [ -- vserver-options ]"
+ echo "Usage: $COMMAND_VBUILD [options] vserver-name [ -- vserver-options ]"
+ echo "Usage: $COMMAND_MYPLC [options] vserver-name repo-url [ -- vserver-options ]"
echo "Requirements: you need to have a vserver-compliant kernel,"
- echo " as well as the util-vserver RPM installed"
+ echo " as well as the util-vserver RPM installed"
echo "Description:"
- echo " This command creates a fresh vserver instance, for building, or running, myplc"
+ echo " This command creates a fresh vserver instance, for building, or running, myplc"
echo "Supported options"
echo " -f fcdistro - for creating the root filesystem - defaults to $DEFAULT_FCDISTRO"
echo " -d pldistro - defaults to $DEFAULT_PLDISTRO"
echo " -p personality - defaults to $DEFAULT_PERSONALITY"
- echo " -v : passes -v to calls to vserver"
+ echo " -v : verbose - passes -v to calls to vserver"
+ echo "vserver-options"
+ echo " all args after the optional -- are passed to vserver <name> build <options>"
+ echo " typical usage is e.g. --interface eth0:200.150.100.10/24"
exit 1
}