|
|
@ -230,12 +230,12 @@ function command::exec() { |
|
|
function init:update_yum_repos() { |
|
|
function init:update_yum_repos() { |
|
|
log::info "[update-yum-repos]" "更新yum源..." |
|
|
log::info "[update-yum-repos]" "更新yum源..." |
|
|
local host="127.0.0.1" |
|
|
local host="127.0.0.1" |
|
|
|
|
|
local repo="/etc/yum.repos.d/CentOS-Base.repo" |
|
|
local repo_bak="/etc/yum.repos.d/CentOS-Base.repo_bak" |
|
|
local repo_bak="/etc/yum.repos.d/CentOS-Base.repo_bak" |
|
|
command::exec "${host}" " |
|
|
command::exec "${host}" " |
|
|
$(declare -f utils::download_file) |
|
|
|
|
|
if [ ! -f "$repo_bak" ]; then |
|
|
if [ ! -f "$repo_bak" ]; then |
|
|
mv /etc/yum.repos.d/CentOS-Base.repo $repo_bak |
|
|
mv $repo $repo_bak |
|
|
utils::download_file ${YUM_REPOS} /etc/yum.repos.d/CentOS-Base.repo |
|
|
wget --timeout=10 --waitretry=3 --tries=5 --retry-connrefused --no-check-certificate ${YUM_REPOS} -O $repo |
|
|
yum makecache |
|
|
yum makecache |
|
|
fi |
|
|
fi |
|
|
" |
|
|
" |
|
|
|