]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Fix undefined arch on initial bootstrap setup
authorReto Gantenbein <reto.gantenbein@linuxmonk.ch>
Sat, 18 Feb 2017 14:24:03 +0000 (15:24 +0100)
committerReto Gantenbein <reto.gantenbein@linuxmonk.ch>
Sat, 18 Feb 2017 16:08:29 +0000 (17:08 +0100)
Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
templates/lxc-fedora.in

index 9e9bb8d38d353d6947cb062bffe2a2fdc514fd9c..c14c88f97a4e00239b28e3c8fe0c7367a2d6eb18 100644 (file)
@@ -100,8 +100,8 @@ export PATH=${PATH}:/usr/sbin:/usr/bin:/sbin:/bin
 # dnf package manager arguments
 dnf_args=( --assumeyes --best --allowerasing --disablerepo=* --enablerepo=fedora --enablerepo=updates )
 
-# This function is going to setup a minimal Fedora bootstrap environment
-# which will be used to create new containers on non-Fedora hosts.
+# This function is going to setup a minimal host-arch native Fedora bootstrap
+# environment which will be used to create new containers on non-Fedora hosts.
 #
 bootstrap_fedora()
 {
@@ -149,7 +149,7 @@ bootstrap_fedora()
         else
             if [ -z "${mirror}" ]
             then
-                get_mirrors || return $?
+                get_mirrors "${basearch}" || return $?
             fi
             for url in ${mirror:${mirror_urls}}
             do
@@ -659,12 +659,14 @@ download_fedora()
 #
 get_mirrors()
 {
+    local mirror_arch="${1}"
+
     for trynumber in 1 2 3 4
     do
         [ "${trynumber}" != 1 ] && echo -n "Trying again ... "
 
         # choose some mirrors by parsing directory index
-        mirror_urls=$(curl --silent --show-error --fail "${MIRRORLIST_URL}?repo=fedora-${release}&arch=${target_arch}" | sed '/^https:/!d' | sed '2,6!d')
+        mirror_urls=$(curl --silent --show-error --fail "${MIRRORLIST_URL}?repo=fedora-${release}&arch=${mirror_arch}" | sed '/^https:/!d' | sed '2,6!d')
 
         # shellcheck disable=SC2181
         if [ $? -eq 0 ] && [ -n "${mirror_urls}" ]
@@ -813,7 +815,7 @@ setup_repositories()
         # if no mirror given, get an appropriate mirror from the mirror list
         if [ -z "${mirror}" ]
         then
-             get_mirrors || return $?
+             get_mirrors "${target_arch}" || return $?
          else
              # construct release-specific mirror url
              mirror="${mirror}/linux/releases/${release}/Everything/${target_arch}/os"
@@ -1044,18 +1046,18 @@ then
     is_fedora=true
 fi
 
-basearch=${arch}
 # Map a few architectures to their generic Fedora repository archs.
 # The two ARM archs are a bit of a guesstimate for the v5 and v6
 # archs.  V6 should have hardware floating point (Rasberry Pi).
 # The "arm" arch is safer (no hardware floating point).  So
 # there may be cases where we "get it wrong" for some v6 other
 # than RPi.
-case "$arch" in
-i686) basearch=i386 ;;
-armv3l|armv4l|armv5l) basearch=arm ;;
-armv6l|armv7l|armv8l) basearch=armhfp ;;
-*) ;;
+basearch=${arch}
+case "${arch}" in
+    i686)                 basearch=i386   ;;
+    armv3l|armv4l|armv5l) basearch=arm    ;;
+    armv6l|armv7l|armv8l) basearch=armhfp ;;
+    *) ;;
 esac
 
 case "${basearch}" in