#!/bin/bash
# VMware tool在centos7系统下的自动化安装
#运行前提:linux.iso 已挂载
#1. 检查挂载目录是否存在,有则跳过,创建新目录,指导创建成功,返回绝对路径
getpath(){
while :
do
let num++
path=/mnt/cdrom${num}
echo $path
[ -e $path ]
if [ $? -ne 0 ];then
mkdir -m 755 -p $path
[ -e $path ]
[ $? -eq 0 ] && echo "$path create successfull " && break
else
echo "$path exist!!! "
continue
fi
done
}
getpath
mount -t iso9660 /dev/cdrom $path
if [ $? -ne 0 ];then
echo "mount tools.iso error"
exit
fi
ls $path |egrep '^VM'
if [ $? -eq 0 ];then
echo "vm tools mount successfull"
else
echo "vm tools mount error"
exit
fi
packge=`ls $path | egrep '^VM'`
if [ $? -ne 0 ];then
echo " get packge error"
exit
fi
cp ${path}/${packge} /root/${packge}
tar -xzf /root/${packge}
[ -e /root/vmware-tools-distrib/vmware-install.pl ]
if [ $? -ne 0 ];then
echo " no vmware-install.pl file"
exit
fi
while :
do
cd /root/vmware-tools-distrib/
./vmware-install.pl
case $? in
0) echo "tools start successfull" ; exit;;
126) installRely;;
*) echo "unknown error" ; exit;;
esac
done
installRely(){
yum -y install perl gcc make kernel-headers kernel-devel
if [ $? -ne 0 ];then
echo " error:check your yum"
exit
fi
continue
}
VMware tool在centos7系统下的自动化安装
最新推荐文章于 2023-08-26 12:00:34 发布