X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lbuild-initvm.sh;h=e6aa67de73281cc84f2ae856561771b096735953;hb=75d4cc85a170771ebe34c1c927a883bbf9623d1e;hp=2f27397716b5ac9344e93f8bc4538383ffb1dcb7;hpb=a2ce0406919d9960d3afd3e832480936b612b682;p=build.git diff --git a/lbuild-initvm.sh b/lbuild-initvm.sh index 2f273977..e6aa67de 100755 --- a/lbuild-initvm.sh +++ b/lbuild-initvm.sh @@ -165,10 +165,13 @@ function fedora_download() { MIRROR_URL=$FEDORA_MIRROR_BASE/releases/$release/Everything/$arch/os RELEASE_URL1="$MIRROR_URL/Packages/fedora-release-$release-1.noarch.rpm" # with fedora18 the rpms are scattered by first name - RELEASE_URL2="$MIRROR_URL/Packages/f/fedora-release-$release-1.noarch.rpm" + # first try the second version of fedora-release first + RELEASE_URL2="$MIRROR_URL/Packages/f/fedora-release-$release-2.noarch.rpm" + RELEASE_URL3="$MIRROR_URL/Packages/f/fedora-release-$release-1.noarch.rpm" + RELEASE_TARGET=$INSTALL_ROOT/fedora-release-$release.noarch.rpm found="" - for attempt in $RELEASE_URL1 $RELEASE_URL2; do + for attempt in $RELEASE_URL1 $RELEASE_URL2 $RELEASE_URL3; do if curl -f $attempt -o $RELEASE_TARGET ; then echo "Retrieved $attempt" found=true @@ -453,9 +456,11 @@ function setup_lxc() { # Enable cgroup -- xxx -- is this really useful ? [ -d $lxc_root/cgroup ] || mkdir $lxc_root/cgroup - # set up resolv.conf + ### set up resolv.conf from host + # ubuntu precise and on, /etc/resolv.conf is a symlink to ../run/resolvconf/resolv.conf + [ -h $lxc_root/etc/resolv.conf ] && rm -f $lxc_root/etc/resolv.conf cp /etc/resolv.conf $lxc_root/etc/resolv.conf - # and /etc/hosts for at least localhost + ### and /etc/hosts for at least localhost [ -f $lxc_root/etc/hosts ] || echo "127.0.0.1 localhost localhost.localdomain" > $lxc_root/etc/hosts # grant ssh access from host to guest @@ -645,7 +650,10 @@ function post_install () { if [ -n "$START_VM" ] ; then virsh -c lxc:/// start $lxc # manually run dhclient in guest - somehow this network won't start on its own - virsh -c lxc:/// lxc-enter-namespace $lxc /usr/bin/$personality /bin/bash -c "dhclient $VIF_GUEST" + # we need the --noseclabel flag with recent libvirt's + # was not required with f20/libvirt-1.2.5 + # but is now with f21/libvirt-1.2.9 + virsh -c lxc:/// lxc-enter-namespace --noseclabel $lxc /usr/bin/$personality /bin/bash -c "dhclient $VIF_GUEST" fi else post_install_myplc $lxc $personality