#! /bin/bash
#这是创建yum仓库的脚本
me=/media
echo "挂载光盘...."
[ -d /media/cdrom ] || mkdir /media/cdrom
mount | grep -q "/dev/cdrom" && umount /dev/cdrom
mount /dev/cdrom $me &>/dev/null
echo "建立yum仓库...."
cd /etc/yum.repos.d
[ -d a ] || mkdir a
mv C* a/
cat << EOF > local.repo
[cdrom]
name=cdrom
baseurl=file://$me
enabled=1
gpgcheck=0
EOF
echo "清除yum缓存,建立yum...."
yum -y clean all &> /dev/null && yum makecache &> /dev/null && echo "yum创建成功"