#!/usr/bin/bash # 配置nexus 客户端 bar=" ==================================\n Nexus 客户端配置 \n 1. 配置yum源 \n 2. 配置docker镜像仓库 \n 3. 配置pip源 \n 4. 【未启用】配置npm源 \n 5. 【未启用】配置maven源 \n q. 退出 \n =================================" echo -e $bar read -p "请选择配置项: " num case $num in 1) 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 "缓存创建完成" ;; 2) 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 配置完成" ;; 3) 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 配置完成" ;; 4) echo "暂不支持" ;; 5) echo "暂不支持" ;; q) exit 0 ;; *) echo "输入有误,请重新输入" ;; esac