From 6eddb1e78fa6e4f68c64b462cf1675cdcb342379 Mon Sep 17 00:00:00 2001 From: Tian jianyong <11429339@qq.com> Date: Fri, 20 Dec 2024 18:29:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E7=BD=B2=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/deploy.sh | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 9b32bd4..5495e79 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -31,8 +31,17 @@ PROJECT_ROOT="$(dirname "${SCRIPT_DIR}")" # Install RPM packages log_info "Installing RPM packages..." -cd "${PROJECT_ROOT}/deploy/rpm" +if [ ! -d "${PROJECT_ROOT}/rpm" ]; then + log_error "RPM directory not found: ${PROJECT_ROOT}/rpm" + exit 1 +fi +cd "${PROJECT_ROOT}/rpm" + # Install Python3 and its dependencies +if ! ls python3*.rpm >/dev/null 2>&1; then + log_error "Python3 RPM packages not found" + exit 1 +fi rpm -Uvh --nodeps python3*.rpm # Create work directory @@ -43,16 +52,22 @@ mkdir -p $WORK_DIR/tools # Copy files log_info "Copying files..." -cp -r "${PROJECT_ROOT}/deploy/bin/"* "/usr/local/bin/" -cp -r "${PROJECT_ROOT}/deploy/lib/"* "/usr/lib64/" -cp -r "${PROJECT_ROOT}/deploy/python/"* "/tmp/" -cp -r "${PROJECT_ROOT}/deploy/tools/"* "$WORK_DIR/tools/" +for dir in bin lib python tools config; do + if [ ! -d "${PROJECT_ROOT}/${dir}" ]; then + log_error "Directory not found: ${PROJECT_ROOT}/${dir}" + exit 1 + fi +done +cp -r "${PROJECT_ROOT}/bin/"* "/usr/local/bin/" +cp -r "${PROJECT_ROOT}/lib/"* "/usr/lib64/" +cp -r "${PROJECT_ROOT}/python/"* "/tmp/" +cp -r "${PROJECT_ROOT}/tools/"* "$WORK_DIR/tools/" # Create config directory CONFIG_DIR="/etc/collision_avoidance" log_info "Creating config directory: $CONFIG_DIR" mkdir -p $CONFIG_DIR -cp -r "${PROJECT_ROOT}/deploy/config/"* "$CONFIG_DIR/" +cp -r "${PROJECT_ROOT}/config/"* "$CONFIG_DIR/" # Install Python packages log_info "Installing Python packages..." @@ -87,6 +102,10 @@ EOL # Configure firewall log_info "Configuring firewall..." if command -v firewall-cmd &> /dev/null; then + if ! systemctl is-active --quiet firewalld; then + log_info "Starting firewalld service..." + systemctl start firewalld + fi firewall-cmd --permanent --add-port=8010/tcp firewall-cmd --permanent --add-port=8081/tcp firewall-cmd --reload