From dda03ab1100c732fb333732dcb1167b613b01e30 Mon Sep 17 00:00:00 2001 From: bigeagle Date: Mon, 9 May 2016 18:04:14 +0800 Subject: [PATCH] added timeout to apt-download --- gitlab-ce.sh | 3 ++- helpers/apt-download | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gitlab-ce.sh b/gitlab-ce.sh index 532e2a2..b8de321 100755 --- a/gitlab-ce.sh +++ b/gitlab-ce.sh @@ -1,5 +1,6 @@ #!/bin/bash set -e +set -o pipefail _here=`dirname $(realpath $0)` . ${_here}/helpers/apt-download @@ -42,7 +43,7 @@ gpgkey=https://packages.gitlab.com/gpg.key sslverify=0 EOF -reposync -c $cfg -d -p ${YUM_PATH} -e $cache_dir +reposync -c $cfg -d -p ${YUM_PATH} -e $cache_dir createrepo --update -v -c $cache_dir -o ${YUM_PATH}/el6 ${YUM_PATH}/el6 createrepo --update -v -c $cache_dir -o ${YUM_PATH}/el7 ${YUM_PATH}/el7 rm $cfg diff --git a/helpers/apt-download b/helpers/apt-download index f9d0f12..b345ec3 100644 --- a/helpers/apt-download +++ b/helpers/apt-download @@ -1,14 +1,15 @@ #!/bin/bash set -e +set -o pipefail LOADED_APT_DOWNLOAD="yes" function check-and-download() { remote_file=$1 local_file=$2 - wget -q --spider ${remote_file} + timeout -s INT 60 wget -q --spider ${remote_file} if [ $? -eq 0 ]; then echo "downloading ${remote_file}" - wget -q -N -O ${local_file} ${remote_file} + timeout -s INT 300 wget -q -N -O ${local_file} ${remote_file} return fi return 0 @@ -25,6 +26,7 @@ function apt-download-binary() { echo "Destination directory is empty, cannot continue" return 1 fi + echo "Started mirroring ${base_url} ${dist}, ${repo}, ${arch}!" dest_dir="${dest_base_dir}/dists/${dist}" [ ! -d "$dest_dir" ] && mkdir -p "$dest_dir"