From e223a03eaeab2b521865d38303110b34e97c8821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=94=E5=A7=AC=E6=A1=91?= <867057410@qq.com> Date: Tue, 15 Nov 2022 21:27:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=20=E5=AE=89=E8=A3=9D?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=9A=84=E6=A3=80=E6=B5=8B&=E6=B8=85?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 34 +++++++++++++++++++++++++++++++++- update.sh | 1 + 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 623ed39f..20dfaef5 100644 --- a/install.sh +++ b/install.sh @@ -1,6 +1,15 @@ #!/usr/bin/env bash +#清理不需要的文件 +clean_files(){ + if [ -f .user.ini ]; then + chattr -i .user.ini + fi + rm -rf .htaccess 404.html index.html .user.ini +} + #检查系统 check_sys(){ + # shellcheck disable=SC2002 if [[ -f /etc/redhat-release ]]; then release="centos" elif cat /etc/issue | grep -q -E -i "debian"; then @@ -15,7 +24,29 @@ check_sys(){ release="ubuntu" elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then release="centos" - fi + fi + + echo "========= Checking for Software dependency | 检查依赖软件是否安装/运行 =========" + if which redis-cli >/dev/null; then + echo -e "\e[37;42m Redis Installed! | Redis 已安装!\e[0m" + redis-cli ping + else + echo -e "\e[37;1;41m Redis did not installed! | redis 未安装!\e[0m" + fi + + if which php >/dev/null; then + echo -e "\e[37;42m PHP Installed! | PHP 已安装!\e[0m" + php -v + else + echo -e "\e[37;1;41m PHP did not installed! | PHP 未安装!\e[0m" + fi + + if which nginx >/dev/null; then + echo -e "\e[37;42m Nginx Installed! | Nginx 已安装!\e[0m" + nginx -v + else + echo -e "\e[37;1;41m Nginx did not installed! | Nginx 未安装!\e[0m" + fi } #检查composer是否安装 check_composer(){ @@ -50,6 +81,7 @@ set_crontab(){ ( crontab -l | grep -v -F "$cmd" ; echo "$cronjob" ) | crontab - } +clean_files check_sys check_composer composer install diff --git a/update.sh b/update.sh index 0894dde7..47a81e04 100644 --- a/update.sh +++ b/update.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash #检查系统 check_sys(){ + # shellcheck disable=SC2002 if [[ -f /etc/redhat-release ]]; then release="centos" elif cat /etc/issue | grep -q -E -i "debian"; then