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.
shell-project/os/get-repo.sh

67 lines
2.2 KiB

#!/usr/bin/bash
# 配置nexus 客户端
bar="
==================================\n
Nexus 客户端配置 \n
1. 配置yum源 \n
2. 配置docker镜像仓库 \n
3. 配置pip源 \n
4. 【未启用】配置npm源 \n
5. 【未启用】配置maven源 \n
6. 配置阿里云源 \n
q. 退出 \n
================================="
echo -e $bar
read -p "请选择配置项: " num
7 months ago
if [[ $num -eq 1 ]];then
cd /etc/yum.repos.d/ && \
dirname=$(mktemp -d repo-XXXXX)
mv *.repo $dirname 2>/dev/null
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 配置完成"
sleep 0.5
done
echo "开始创建缓存"
yum clean all && \
yum makecache && \
echo "缓存创建完成"
7 months ago
elif [[ $num -eq 2 ]];then
if [ ! -d "/etc/docker/" ]; then
mkdir /etc/docker
fi
curl -o /etc/docker/daemon.json https://gitea.beyourself.org.cn/newrain001/download/raw/branch/master/repo/nexus-daemon.json
echo "daemon.json 配置完成"
7 months ago
elif [[ $num -eq 3 ]];then
if [ ! -d $HOME/.pip ]; then
mkdir $HOME/.pip
fi
curl -o $HOME/.pip/pip.conf https://gitea.beyourself.org.cn/newrain001/download/raw/branch/master/repo/pip.conf
echo "pip.conf 配置完成"
7 months ago
elif [[ $num -eq 4 ]];then
echo "暂不支持"
7 months ago
elif [[ $num -eq 5 ]];then
echo "暂不支持"
7 months ago
elif [[ $num -eq 6 ]];then
cd /etc/yum.repos.d/ && \
dirname=$(mktemp -d repo-XXXXX)
mv *.repo $dirname 2>/dev/null
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 "阿里云源配置完成"
7 months ago
echo "开始创建缓存"
yum clean all && \
yum makecache && \
echo "缓存创建完成"
elif [[ $num == "q" ]];then
exit 0
7 months ago
else
echo "输入有误,请重新输入"
7 months ago
fi