Files
ServerStack/lib/download.sh
T
condor 679e0b4184 init
2026-07-24 18:54:53 +08:00

29 lines
1.1 KiB
Bash

#!/bin/bash
# Author: yeho <lj2007331 AT gmail.com>
# BLOG: https://linuxeye.com
#
# Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
#
# Project home page:
# https://oneinstack.com
# https://github.com/oneinstack/oneinstack
Download_src() {
if [ -s "${src_url##*/}" ]; then
echo "[${CMSG}${src_url##*/}${CEND}] found"
elif [ "${OFFLINE}" == '1' ]; then
# Offline mode: never touch the network. Fail clearly so the missing
# package can be added to the offline src/ set.
echo "${CFAILURE}Offline mode: ${src_url##*/} not found in src/. Add it to the offline package set and retry.${CEND}"
kill -9 $$; exit 1;
else
# --timeout caps DNS/connect/read at 30s so a dead mirror can't hang for ~90 min;
# --tries=3 keeps a couple of retries without the old 6x15min worst case.
wget --limit-rate=100M --timeout=30 --tries=3 -c --no-check-certificate ${src_url}; sleep 1
fi
if [ ! -e "${src_url##*/}" ]; then
echo "${CFAILURE}Auto download failed! You can manually download ${src_url} into the oneinstack/src directory.${CEND}"
kill -9 $$; exit 1;
fi
}