Browse Source

Merge "download_mirror.sh fails with 404 errors"

changes/96/643496/2
Zuul 2 months ago
parent
commit
e55ced2404
3 changed files with 21 additions and 1 deletions
  1. 2
    0
      Dockerfile
  2. 18
    1
      centos-mirror-tools/dl_rpms.sh
  3. 1
    0
      centos-mirror-tools/yum.conf.sample

+ 2
- 0
Dockerfile View File

@@ -21,6 +21,8 @@ FROM centos:7.4.1708
21 21
 #    echo -e "export http_proxy=$http_proxy\nexport https_proxy=$https_proxy\n\
22 22
 #export ftp_proxy=$ftp_proxy" >> /root/.bashrc
23 23
 
24
+RUN echo "http_caching=packages" >> /etc/yum.conf
25
+
24 26
 # username you will docker exec into the container as.
25 27
 # It should NOT be your host username so you can easily tell
26 28
 # if you are in our out of the container.

+ 18
- 1
centos-mirror-tools/dl_rpms.sh View File

@@ -251,7 +251,24 @@ download () {
251 251
 
252 252
 
253 253
 # Prime the cache
254
-${SUDOCMD} yum ${YUMCONFOPT} ${RELEASEVER} makecache
254
+loop_count=0
255
+max_loop_count=5
256
+echo "${SUDOCMD} yum ${YUMCONFOPT} ${RELEASEVER} makecache"
257
+while ! ${SUDOCMD} yum ${YUMCONFOPT} ${RELEASEVER} makecache ; do
258
+    # To protect against intermittent 404 errors, we'll retry
259
+    # a few times.  The suspected issue is pulling repodata
260
+    # from multiple source that are temporarily inconsistent.
261
+    loop_count=$((loop_count + 1))
262
+    if [ $loop_count -gt $max_loop_count ]; then
263
+        break
264
+    fi
265
+    echo "makecache retry: $loop_count"
266
+
267
+    # Wipe the inconsistent data from the last try
268
+    echo "yum ${YUMCONFOPT} ${RELEASEVER} clean all"
269
+    yum ${YUMCONFOPT} ${RELEASEVER} clean all
270
+done
271
+
255 272
 
256 273
 # Download files
257 274
 if [ -s "$rpms_list" ];then

+ 1
- 0
centos-mirror-tools/yum.conf.sample View File

@@ -13,6 +13,7 @@ bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://b
13 13
 distroverpkg=centos-release
14 14
 override_install_langs=en_US.utf8
15 15
 tsflags=nodocs
16
+http_caching=packages
16 17
 reposdir=yum.repos.d
17 18
 
18 19
 

Loading…
Cancel
Save