RHEL5 脚本实现光盘YUM源

#!/bin/bash
#By Crushlinux 2013-08-04
echo "---------------------- Create YUM ----------------------"
rm -rf /etc/yum.repos.d/yum.repo
umount /dev/cdrom 2>&1 >> /dev/null &&
mount /dev/cdrom /mnt 2>&1 >> /dev/null &&
mkdir /etc/yum.repos.d/bak
mv   `ls /etc/yum.repos.d/ |grep -v ^bak$` /etc/yum.repos.d/bak 2>&1 >> /dev/null &&
touch /etc/yum.repos.d/yum.repo
echo "[server]" >>/etc/yum.repos.d/yum.repo
echo "name=server" >>/etc/yum.repos.d/yum.repo
echo "baseurl=file:///mnt/Server" >>/etc/yum.repos.d/yum.repo
echo "enable=1" >>/etc/yum.repos.d/yum.repo
echo "gpgcheck=0" >>/etc/yum.repos.d/yum.repo
echo "---------------------- Server is ok ----------------------"
echo "[ClusterStorage]" >>/etc/yum.repos.d/yum.repo
echo "name=ClusterStorage" >>/etc/yum.repos.d/yum.repo
echo "baseurl=file:///mnt/ClusterStorage" >>/etc/yum.repos.d/yum.repo
echo "enable=1" >>/etc/yum.repos.d/yum.repo
echo "gpgcheck=0" >>/etc/yum.repos.d/yum.repo
echo "---------------------- Storage is ok ----------------------"
echo "[Cluster]" >>/etc/yum.repos.d/yum.repo
echo "name=Cluster" >>/etc/yum.repos.d/yum.repo
echo "baseurl=file:///mnt/Cluster" >>/etc/yum.repos.d/yum.repo
echo "enable=1" >>/etc/yum.repos.d/yum.repo
echo "gpgcheck=0" >>/etc/yum.repos.d/yum.repo
echo "---------------------- Cluster is ok ----------------------"
echo "[VT]" >>/etc/yum.repos.d/yum.repo
echo "name=VT" >>/etc/yum.repos.d/yum.repo
echo "baseurl=file:///mnt/VT" >>/etc/yum.repos.d/yum.repo
echo "enable=1" >>/etc/yum.repos.d/yum.repo
echo "gpgcheck=0" >>/etc/yum.repos.d/yum.repo
echo "---------------------- VT is ok ----------------------"
yum clean all 2>&1 >> /dev/null &&
#yum list 2>&1 >>/dev/null &&
echo "IS Testing"
for i in `seq 1 5`
do
    echo -n "."
    sleep 1
done
echo " "
echo "create yum is ok"
echo "Please enter " yum -y install softname ""


你可能感兴趣的:(yum,rhel5)