You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
yum_repo(){
|
|
|
|
cd /etc/yum.repos.d/ && \
|
|
|
|
dirname=$(mktemp -d repo-XXXXX)
|
|
|
|
mv *.repo $dirname 2>/dev/null
|
|
|
|
if [ $repo_type -eq 0 ];then
|
|
|
|
echo "$repo yum.cloud.repo " >> /etc/hosts
|
|
|
|
echo "开始下载资源,请等待"
|
|
|
|
for i in nexus-Centos-Base.repo nexus-epel.repo nexus-mysql.repo nexus-docker-ce.repo nexus-kubernetes.repo
|
|
|
|
do
|
|
|
|
curl -s -o $i "https://gitea.beyourself.org.cn/newrain001/download/raw/branch/master/repo/$i"
|
|
|
|
echo "yum 源 $i 配置完成"
|
|
|
|
done
|
|
|
|
|
|
|
|
elif [ $repo_type -eq 1 ];then
|
|
|
|
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
|
|
|
|
curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
|
|
|
|
echo "阿里云源配置完成"
|
|
|
|
fi
|
|
|
|
echo "开始创建缓存"
|
|
|
|
yum clean all && \
|
|
|
|
yum makecache && \
|
|
|
|
echo "缓存创建完成"
|
|
|
|
}
|
|
|
|
ping -w2 -c2 "$repo" &>/dev/null
|
|
|
|
if [ $? -eq 0 ];then
|
|
|
|
repo_type=0
|
|
|
|
else
|
|
|
|
repo_type=1
|
|
|
|
fi
|
|
|
|
yum_repo
|