Skip to content

Commit c652a49

Browse files
committed
Fix partial download problem
(1) when checksum fails, better delete the broken files and try the second time; (2) amazon s3 is not good in mainland China, better try one more time with wget Change-Id: I24ee73f216b78bd80564863cd335e5d5a9b56360
1 parent f56a0ae commit c652a49

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

functions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function get_extra_file {
6363
if [[ $file_url != file* ]]; then
6464
# If the file isn't cache, download it
6565
if [[ ! -f $FILES/$file_name ]]; then
66-
wget --progress=dot:giga -c $file_url -O $FILES/$file_name
66+
wget --progress=dot:giga -t 2 -c $file_url -O $FILES/$file_name
6767
if [[ $? -ne 0 ]]; then
6868
die "$file_url could not be downloaded"
6969
fi

lib/etcd3

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ function install_etcd3 {
9898
etcd_file="$(get_extra_file $ETCD_DOWNLOAD_LOCATION)"
9999
if [ ! -f "$FILES/etcd-$ETCD_VERSION-linux-$ETCD_ARCH/etcd" ]; then
100100
echo "${ETCD_SHA256} $etcd_file" > $FILES/etcd.sha256sum
101-
# NOTE(sdague): this should go fatal if this fails
102-
sha256sum -c $FILES/etcd.sha256sum
101+
# NOTE(yuanke wei): rm the damaged file when checksum fails
102+
sha256sum -c $FILES/etcd.sha256sum || (sudo rm -f $etcd_file; exit 1)
103103

104104
tar xzvf $etcd_file -C $FILES
105105
sudo cp $FILES/$ETCD_NAME/etcd $ETCD_BIN_DIR/etcd

0 commit comments

Comments
 (0)