#!/bin/bash
umount /dev/cdrom
echo $? "卸载光盘"
[ -d /media/cdrom/ ] || mkdir /media/cdrom
echo $? "创建挂载目录"
mount /dev/cdrom /media/cdrom
echo $? "挂载光盘"
cd /etc/yum.repos.d
echo $? "进目录"
[ -d a/ ] || mkdir a/
echo $? "创建文件夹"
mv *.repo a/
echo $? "移动文件到a"
cat << EOF > local.repo
[xxx]
name=xxx
baseurl=file:///media/cdrom
enabled=1
gpgcheck=0
EOF
yum clean all && yum makecache
echo $? "清除重建yum缓存"