install NetworkManager in spawned f27 containers as well
[build.git] / lbuild-initvm.sh
index 9cc3fb5..da0ef1c 100755 (executable)
@@ -43,7 +43,7 @@ PUBLIC_BRIDGE=br0
 VIF_GUEST=eth0
 
 ##########
-FEDORA_MIRROR_BASE="http://mirror.onelab.eu/fedora/"
+FEDORA_MIRROR="http://mirror.onelab.eu/"
 FEDORA_MIRROR_KEYS="http://mirror.onelab.eu/keys/"
 FEDORA_PREINSTALLED="dnf dnf-yum passwd rsyslog vim-minimal dhclient chkconfig rootfiles policycoreutils openssh-server openssh-clients"
 DEBIAN_PREINSTALLED="openssh-server openssh-client"
@@ -179,20 +179,20 @@ function fedora_download() {
 
     # copy yum config and repo files
     cp /etc/yum.conf $INSTALL_ROOT/etc/
-    cp /etc/yum.repos.d/fedora* $INSTALL_ROOT/etc/yum.repos.d/
+    cp /etc/yum.repos.d/fedora{,-updates}.repo $INSTALL_ROOT/etc/yum.repos.d/
 
     # append fedora repo files with desired ${fedora_release} and $basearch
     for f in $INSTALL_ROOT/etc/yum.repos.d/* ; do
       sed -i "s/\$basearch/$arch/g; s/\$releasever/${fedora_release}/g;" $f
     done
 
-    MIRROR_URL=$FEDORA_MIRROR_BASE/releases/${fedora_release}/Everything/$arch/os
+    MIRROR_URL=$FEDORA_MIRROR/fedora/releases/${fedora_release}/Everything/$arch/os
     # since fedora18 the rpms are scattered by first name
     # first try the second version of fedora-release first
     RELEASE_URLS=""
     local subindex
     for subindex in 3 2 1; do
-        RELEASE_URLS="$RELEASE_URLS $MIRROR_URL/Packages/f/fedora-release-${fedora_release}-1.noarch.rpm"
+        RELEASE_URLS="$RELEASE_URLS $MIRROR_URL/Packages/f/fedora-release-${fedora_release}-${subindex}.noarch.rpm"
     done
 
     RELEASE_TARGET=$INSTALL_ROOT/fedora-release-${fedora_release}.noarch.rpm
@@ -335,23 +335,12 @@ function fedora_configure_yum () {
     echo "Initializing yum.repos.d in $lxc"
     rm -f $lxc_root/etc/yum.repos.d/*
 
-    cat > $lxc_root/etc/yum.repos.d/building.repo <<EOF
-[fedora]
-name=Fedora \$releasever - \$basearch
-baseurl=$FEDORA_MIRROR_BASE/releases/\$releasever/Everything/\$basearch/os/
-enabled=1
-metadata_expire=7d
-gpgcheck=1
-gpgkey=$FEDORA_MIRROR_KEYS/RPM-GPG-KEY-fedora-${fedora_release}-primary
-
-[updates]
-name=Fedora \$releasever - \$basearch - Updates
-baseurl=$FEDORA_MIRROR_BASE/updates/\$releasever/\$basearch/
-enabled=1
-metadata_expire=7d
-gpgcheck=1
-gpgkey=$FEDORA_MIRROR_KEYS/RPM-GPG-KEY-fedora-${fedora_release}-primary
-EOF
+    # use mirroring/ stuff instead of a hard-wired config
+    local repofile=$lxc_root/etc/yum.repos.d/building.repo
+    yumconf_mirrors $repofile ${DIRNAME} $fcdistro \
+        "" $FEDORA_MIRROR
+    # the keys stuff requires adjustment though
+    sed -i $repofile -e s,'gpgkey=.*',"gpgkey=${FEDORA_MIRROR_KEYS}/RPM-GPG-KEY-fedora-${fedora_release}-primary,"
 
     # import fedora key so that gpgckeck does not whine or require stdin
     # required since fedora24