diff --git a/lemp.sh b/lemp.sh index a475c81..a7c948c 100755 --- a/lemp.sh +++ b/lemp.sh @@ -5,6 +5,18 @@ SCRIPT_ROOT=`pwd` cd $SCRIPT_ROOT +# Checking +echo "Checking..." +if [ -n "`grep 'Aliyun Linux release' /etc/issue`" -o -e /etc/redhat-release ];then + OS=CentOS + [ -n "`grep ' 7\.' /etc/redhat-release`" ] && CentOS_RHEL_version=7 +fi + +if [ $OS != 'CentOS' ] || [ $CentOS_RHEL_version != '7' ];then + echo "${CFAILURE}Error: This script only support CentOS 7${CEND}"; + kill -9 $$ +fi + while :; do echo read -p "Do you want to init your CentOS? [y/n]:(Default y press Enter) " init_yn [ -z "$init_yn" ] && init_yn=y @@ -46,11 +58,12 @@ while :; do echo read -p "Please type MariaDB root password:(Default lemp.sh press Enter) " MariaDB_ROOT_PWD [ -z "$MariaDB_ROOT_PWD" ] && MariaDB_ROOT_PWD="lemp.sh" [ -n "`echo $MariaDB_ROOT_PWD | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; } - break; + break done else break fi + break fi done @@ -61,7 +74,7 @@ fi # Install base packages echo "Installing base packages..." sudo yum -y update -sudo yum -y install vim wget epel-release unzip git +sudo yum -y install sudo vim wget epel-release unzip git if [ "$nginx_yn" == 'y' ]; then . ./utils/nginx.sh diff --git a/utils/init.sh b/utils/init.sh index a9c68fc..aa7daff 100644 --- a/utils/init.sh +++ b/utils/init.sh @@ -1,16 +1,4 @@ #!/bin/bash - -# Checking -echo "Checking..." -if [ -n "`grep 'Aliyun Linux release' /etc/issue`" -o -e /etc/redhat-release ];then - OS=CentOS - [ -n "`grep ' 7\.' /etc/redhat-release`" ] && CentOS_RHEL_version=7 -fi - -if [ $OS != 'CentOS' ] || [ $CentOS_RHEL_version != '7' ];then - echo "${CFAILURE}Error: This script only support CentOS 7${CEND}"; - kill -9 $$ -fi # Close SELINUX setenforce 0