-
Notifications
You must be signed in to change notification settings - Fork 1
Home
dragonhht edited this page Oct 13, 2017
·
3 revisions
Welcome to the Notes wiki!
#! /bin/bash
mount_iso() {
if [ -e /yum ];then
echo "cunzai"
else
mkdir /yum
fi
df -h | grep CentOS
if [ $? -eq 0 ];then
df -h | grep /yum
if [ $? -eq 0 ];then
echo "yizhuagnzai"
else
mount -o loop /dev/sr0 /yum
fi
else
echo "isoweitainjai"
exit 1
fi
}
yum_conf() {
cd /etc/yum.repos.d/
if [ -e base ];then
echo "you base mulu"
else
mkdir base
fi
mv ./*.repo base/
touch centos.repo
echo -e "[centos]\nname=centos\nbaseurl=file:///yum\nenabled=1\ngpgcheck=0" > centos.repo
yum list
}
install_httpd(){
yum -y install httpd
systemctl start httpd.service
if [ $? -eq 0 ];then
echo "start success"
else
echo "start failed"
fi
}
read -p "input (iso or yum or httpd 0r auto) " comm
case $comm in
iso)
mount_iso
;;
yum)
yum_conf
;;
httpd)
install_httpd
;;
auto)
mount_iso
yum_conf
install_httpd
;;
esac