简化安装增加所依赖的软件校验功能

This commit is contained in:
liang_-123 2021-02-22 14:32:19 +08:00
parent fa27d80824
commit ffa3e5e259
5 changed files with 108 additions and 1 deletions

View File

@ -35,4 +35,40 @@ function fn_selinux()
return 0
}
function fn_precheck()
{
system_arch=`uname -p`
system_name=`cat /etc/os-release | grep '^ID=".*' | grep -o -E '(openEuler|centos)'`
total=0
python3 --version >/dev/null 2>&1
if [ $? -ne 0 ]
then
echo "You need install python3 or create the correct soft connection."
return 1
fi
cat requirements_"$system_name"_"$system_arch" | while read line
do
if [ "$line"x == ""x ]
then
continue
fi
yum list installed | grep $line > result.log
num=`wc -l result.log | awk '{print $1}'`
if [ $num -eq 0 ]
then
echo "You need to install $line" > preCheck.log
total=`expr $total + 1`
fi
echo $total>>tmp_total
done < requirements_"$system_name"_"$system_arch"
total=$(tail -n 1 tmp_total)
if [ $total -gt 0 ]
then
rm -rf result.log tmp_total
return 1
fi
rm -rf result.log tmp_total
return 0
}
COMMON_SH="common.sh"

View File

@ -172,6 +172,18 @@ function fn_post_check()
else
echo "Check input success."
fi
fn_precheck
if [ $? -ne 0 ]
then
echo "Precheck failed.you can check preCheck.log for more details."
fn_precheck_result
if [ $? -ne 0 ]
then
return 1
fi
else
echo "Precheck success."
fi
fn_check_firewall $host_port
if [ $? -ne 0 ]
then
@ -190,6 +202,24 @@ function fn_post_check()
fi
return 0
}
function fn_precheck_result()
{
input=$1
if [ "$input"X = X ]
then
read -p "Are you sure you want to continue?(yes/no)" input
fi
if [ "$input"X == "yes"X ]
then
return 0
elif [ "$input"X == "no"X ]
then
return 1
else
read -p "Please type 'yes' or 'no': " input
fn_precheck_result $input
fi
}
function fn_check_input()
{
@ -370,7 +400,9 @@ function main()
return 1
elif [ $returnFlag -eq 1 ]
then
echo "Load demoDB failed, you can check load.log for more details"
echo "Load demoDB failed, you can check load.log for more details."
else
echo "Input no, operation skip."
fi
return 0
}

View File

@ -0,0 +1,14 @@
libaio-devel
flex
bison
ncurses-devel
glibc-devel
patch
readline-devel
bzip2
firewalld
crontabs
net-tools
openssh-server
openssh-clients
which

View File

@ -0,0 +1,12 @@
libaio-devel
flex
bison
ncurses-devel
glibc-devel
patch
readline-devel
bzip2
firewalld
crontabs
net-tools
which

View File

@ -0,0 +1,13 @@
libaio-devel
flex
bison
ncurses-devel
glibc-devel
patch
readline-devel
bzip2
firewalld
crontabs
net-tools
which
libnsl