#!/bin/bash
# Description:
# Date && Time:2010-12-19 16:10:50
# Author:AIDA_ZYF
# Version:2.6.18-164.el5
echo "This programe will create a yum_server."
if ! ls -d /var/yum &>/dev/null;then
mkdir /var/yum
if ! ls -d /media/cdrom &>/dev/null;then
mkdir /media/cdrom
mount /dev/cdrom /media/cdrom
else
mount /dev/cdrom /media/cdrom
fi
else
echo "The directory is exit."
mount /dev/cdrom /media/cdrom
fi
rpm -ivh /media/cdrom/Server/createrepo-0.4.11-3.el5.noarch.rpm
cpdir() {
cp -r /media/cdrom/Cluster /var/yum/
cd /var/yum/Cluster/
createrepo -g repodata/comps-rhel5-cluster.xml ./
cp -r /media/cdrom/ClusterStorage /var/yum/
cd /var/yum/ClusterStorage/
createrepo -g repodata/comps-rhel5-cluster-st.xml ./
cp -r /media/cdrom/Server /var/yum/
cd /var/yum/Server/
createrepo -g repodata/comps-rhel5-server-core.xml ./
cp -r /media/cdrom/VT /var/yum/
cd /var/yum/VT/
createrepo -g repodata/comps-rhel5-vt.xml ./
umount /dev/cdrom
rm -rf /var/yum/*/.olddata/
}
cpdir
localrepo() {
echo "Please input a file XX.repo:"
read FILE
touch /etc/yum.repos.d/$FILE
cat >> /etc/yum.repos.d/$FILE << EOF
[Cluster]
name=Cluster Dir
baseurl=file:///var/yum/Cluster
enabled=1
pgpcheck=0
[ClusterStorage]
name=ClusterStorage Dir
baseurl=file:///var/yum/ClusterStorage
enabled=1
gpgcheck=0
[Server]
name=Server Dir
baseurl=file:///var/yum/Server
enabled=1
gpgcheck=0
[VT]
name=VT Dir
baseurl=file:///var/yum/VT
enabled=1
gpgcheck=0
EOF
}
localrepo
echo "Success."
阅读(1086) | 评论(0) | 转发(0) |