Linux 脚本 ----yum脚本

#!/bin/bash
#Author:zxs

systemctl disable firewalld
sed -i '7 s/enforcing/disabled/' /etc/selinux/config

#构建本地yum仓库
umount /dev/sr0
if
[ -e media ]
then
mount /dev/sr0 /media
else
mkdir media
mount /dev/sr0 /media
fi

cd /etc/yum.repos.d/
if
[ -e z ]
then
mv C* z/
else
mkdir z/
mv C* z/
fi

cat << EOF > zxs.repo
[zzz]
name=zzz
baseurl=file:///media
enabled=1
gpgcheck=0
EOF

yum clean all &> /dev/null && yum makecache &> /dev/null

if [ $? -eq 0 ]
then
echo "OK"
else
echo "NO"
fi

posted on 2019-08-28 19:23  iimcan  阅读(274)  评论(0编辑  收藏  举报

导航