master
11617 2 years ago
parent 20633aa928
commit 2ec09d3e72
  1. 10
      os/get-os-init.sh

@ -1,6 +1,8 @@
#!/usr/bin/bash
#set -e
yum_host=192.168.96.197
color(){
unset c
declare -A c=([Error]=31 [Success]=32 [Warning]=33 [Info]=34)
@ -34,7 +36,7 @@ DNS2=114.114.114.114
DNS3=8.8.8.8
EOF
systemctl restart network
ping -w1 -c1 www.baidu.com &>/dev/null && \
ping -w2 -c2 www.baidu.com &>/dev/null && \
return 10 || \
return 20
}
@ -42,13 +44,13 @@ return 20
local_yum_make(){
cd /etc/yum.repos.d/ && \
rename .repo .repo.bak *.repo &>/dev/null
grep '10.8.161.40 package.qf.com' /etc/hosts &>/dev/null
grep "$yum_host package.qf.com" /etc/hosts &>/dev/null
if [ $? -ne 0 ];then
cat >> /etc/hosts <<EOF
10.8.161.40 package.qf.com
$yum_host package.qf.com
EOF
fi
curl -o /etc/yum.repos.d/centos7.repo http://download.beyourself.org.cn/download/repo/centos7-repo && \
curl -o /etc/yum.repos.d/centos7.repo https://download.beyourself.org.cn/repo/centos7-repo && \
yum repolist && yum clean all && yum makecache && \
color Success "本地源配置完成" || color Error "yum配置错误,可以\ncd /etc/yum.repos.d/ && rm -rf centos7.repo && rename .repo.bak .repo *.repo.bak \n使用手动恢复历史yum"
}

Loading…
Cancel
Save