#!/bin/bashrom=/media/cdromdir=/etc/yum.repos.dUse=$1mima=$2function yumj(){[ -d "$rom" ] || mkdir -p "$rom"/bin/umount /dev/sr0/bin/mount /devsro0 $rom[ -d "$dir" ] || mkdir -p "$dir"cd "$dir" &&\mv * /tmp//bin/cat > /etc/yum.repos.d/local.repo << fof[local]name=localrepobasenurl=:///"$rom"gpgcheck=0enabled=1fof/usr/bin/yum -y clean all &>/dev/null/usr/bin/yum makecache &>/dev/null[ $? -eq 0 ] || echo "本地yum出错"which "wget"rom=/media/cdromdir=/etc/yum.repos.dUse=$1mima=$2function yumj(){[ -d "$rom" ] || mkdir -p "$rom"/bin/umount /dev/sr0/bin/mount /devsro0 $rom[ -d "$dir" ] || mkdir -p "$dir"cd "$dir" &&\mv * /tmp//bin/cat > /etc/yum.repos.d/local.repo << fof[local]name=localrepobasenurl=:///"$rom"gpgcheck=0enabled=1fof/usr/bin/yum -y clean all &>/dev/null/usr/bin/yum makecache &>/dev/null[ -d "$rom" ] || mkdir -p "$rom"/bin/umount /dev/sr0/bin/mount /devsro0 $rom[ -d "$dir" ] || mkdir -p "$dir"cd "$dir" &&\mv * /tmp//bin/cat > /etc/yum.repos.d/local.repo << fof[local]name=localrepobasenurl=:///"$rom"gpgcheck=0enabled=1fof/usr/bin/yum -y clean all &>/dev/null/usr/bin/yum makecache &>/dev/null[ $? -eq 0 ] || echo "本地yum出错"which "wget"#!/bin/bashrom=/media/cdromdir=/etc/yum.repos.dUse=$1mima=$2function yumj(){[ -d "$rom" ] || mkdir -p "$rom"/bin/umount /dev/sr0/bin/mount /devsro0 $rom[ -d "$dir" ] || mkdir -p "$dir"cd "$dir" &&\mv * /tmp//bin/cat > /etc/yum.repos.d/local.repo << fof[local]name=localrepobasenurl=:///"$rom"gpgcheck=0enabled=1fof/usr/bin/yum -y clean all &>/dev/null/usr/bin/yum makecache &>/dev/null[ $? -eq 0 ] || echo "本地yum出错"which "wget"[ $? -eq 0 ] || /usr/bin/yum -y install wget &>/dev/null[ $? -eq 0 ] || (/bin/echo "wget error" && exit)/usr/bin/wget http://mirrors.aliyun.com/repo/epel-6.repo[ $? -eq 0 ] || (/bin/echo "yun源出错" && exit)/usr/bin/yum -y clean all &>/dev/null/usr/bin/yum makecache &>/dev/null[ $? -eq 0 ] || (/bin/echo "yun缓存错误" && exit)/bin/echo "yum ok"}/bin/ping -c 2 www.baidu.com &>/dev/null[ $? -eq 0 ] || (/bin/echo "没网" && exit)which "sshpass" &>/dev/null[ $? -eq 0 ] || /usr/bin/yum -y install sshpass &>/dev/nullif [ $? -ne 0 ] ;then yumj /usr/bin/yum -y install sshpass &>/dev/null || (echo "sshpass error" && exit)fi[ -d ~/.ssh ] || mkdir -p ~/.ssh ; chmod 700 ~./sshrm -rf ~/.ssh/id_*ssh-keygen -t dsa -f ~/.ssh/id_dsa -P "" &>/dev/nullfor i in 192.168.200.{1..245}do/bin/ping -c 1 -i 0.1 $i &>/dev/nullif [ $? -eq 0 ];then sshpass -p $mima ssh-copy-id -i ~/.ssh/id_dsa.pub "-o StrictHostKeyChecking=no $Use@$i" echo "$i 密匙成功"fidone