From 92b95be8f9cd50ecc967c1958826f3317a4d6c54 Mon Sep 17 00:00:00 2001 From: hosh1 Date: Sun, 10 Aug 2025 23:02:20 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D1=81=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=BE=D0=B9=20=D0=BD=D0=B0?= =?UTF-8?q?=20=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20=D0=9F=D0=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 63 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/install.sh b/install.sh index 168ad81..cea364d 100644 --- a/install.sh +++ b/install.sh @@ -64,33 +64,63 @@ check_component() { check_existing_installation() { log_step "Проверка существующей установки..." - local apache_status php_status mariadb_status redis_status + local apache_status=2 php_status=2 mariadb_status=2 redis_status=2 local need_reinstall=false # Проверка Apache + log_info "Проверка Apache..." if [ "$DISTRO_FAMILY" = "debian" ]; then - check_component "Apache2" "apache2" "apache2" - apache_status=$? + if command -v apache2 >/dev/null 2>&1; then + if systemctl is-active --quiet apache2 2>/dev/null; then + apache_status=0 + else + apache_status=1 + fi + else + apache_status=2 + fi else - check_component "Apache (httpd)" "httpd" "httpd" - apache_status=$? + if command -v httpd >/dev/null 2>&1; then + if systemctl is-active --quiet httpd 2>/dev/null; then + apache_status=0 + else + apache_status=1 + fi + else + apache_status=2 + fi fi # Проверка PHP - check_component "PHP" "php" "" - php_status=$? + log_info "Проверка PHP..." + if command -v php >/dev/null 2>&1; then + php_status=0 + else + php_status=2 + fi # Проверка MariaDB - check_component "MariaDB" "mysql" "mariadb" - mariadb_status=$? + log_info "Проверка MariaDB..." + if command -v mysql >/dev/null 2>&1; then + if systemctl is-active --quiet mariadb 2>/dev/null; then + mariadb_status=0 + else + mariadb_status=1 + fi + else + mariadb_status=2 + fi # Проверка Redis - check_component "Redis" "redis-server" "redis-server" - if [ $? -eq 2 ]; then - check_component "Redis" "redis-cli" "redis" - redis_status=$? + log_info "Проверка Redis..." + if command -v redis-cli >/dev/null 2>&1; then + if systemctl is-active --quiet redis-server 2>/dev/null || systemctl is-active --quiet redis 2>/dev/null; then + redis_status=0 + else + redis_status=1 + fi else - redis_status=$? + redis_status=2 fi echo "" @@ -104,7 +134,7 @@ check_existing_installation() { case $php_status in 0) - php_version=$(php -v 2>/dev/null | head -1 | cut -d' ' -f2 | cut -d'.' -f1,2) + php_version=$(php -v 2>/dev/null | head -1 | cut -d' ' -f2 | cut -d'.' -f1,2 2>/dev/null || echo "неизвестно") if [[ "$php_version" == "8.3" ]]; then echo -e "PHP: ${GREEN}Установлен (версия $php_version)${NC}" else @@ -752,7 +782,8 @@ log_success "Учетные данные сохранены в $DB_CREDENTIALS_F IP_ADDR=$(hostname -I | awk '{print $1}') -log_success "Установка Altcor успешно завершена" +echo "" +log_success "Установка Altcor успешно завершена." echo "" echo "🌐 Доступ к сайту:" echo " • http://localhost/"