#!/bin/bash
#挂载yum仓库
read -p "请输入你的挂载点: " dir
echo "正在挂载光盘..."
mount | grep -q "/dev/sr0" && umount /dev/sr0
[ -d $dir ] || mkdir $dir
mount /dev/sr0 $dir &> /dev/null
echo "正在修改repo文件..."
cd /etc/yum.repos.d/
[ -d bak ] || mkdir bak
mv *.repo bak
cat << END > local.repo
[xxx]
name=xxx
baseurl=file://$dir
enabled=1
gpgcheck=0
END
echo "正在清除yum缓存..."
yum clean all &> /dev/null
echo "正在建立yum缓存..."
yum makecache &> /dev/null
[ -d $dir/Packages ] && echo "yum构建成功"
原文地址:https://www.cnblogs.com/zhiyuan-yu/p/11405050.html
时间: 2024-10-20 23:26:21