From 181884b931f34837cc5b7e832652e64a7024a1d9 Mon Sep 17 00:00:00 2001 From: Edmund Tan Date: Tue, 22 Jul 2025 02:07:51 +0800 Subject: [PATCH] fix install script4 --- UI/install.sh | 33 +++++++++++++++++++++++++++++---- UI/logs/.gitkeep | 2 ++ UI/temp/.gitkeep | 2 ++ 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 UI/logs/.gitkeep create mode 100644 UI/temp/.gitkeep diff --git a/UI/install.sh b/UI/install.sh index 102d046..8d79a7a 100644 --- a/UI/install.sh +++ b/UI/install.sh @@ -176,13 +176,38 @@ deploy_ui() { # Create web directory mkdir -p "$WEB_DIR" || error_exit "Failed to create web directory" - # Copy UI files (assuming script is run from the UI directory) - if [[ -d "public" && -d "includes" && -d "assets" ]]; then - cp -r public includes assets logs temp README.md "$WEB_DIR/" || error_exit "Failed to copy UI files" - else + # Check for required directories + if [[ ! -d "public" || ! -d "includes" || ! -d "assets" ]]; then error_exit "UI files not found. Please run this script from the UI directory." fi + # Copy main UI files + cp -r public includes assets "$WEB_DIR/" || error_exit "Failed to copy UI files" + + # Copy optional files if they exist + if [[ -f "README.md" ]]; then + cp README.md "$WEB_DIR/" || log "WARNING" "Failed to copy README.md" + fi + + if [[ -f ".htaccess" ]]; then + cp .htaccess "$WEB_DIR/" || log "WARNING" "Failed to copy .htaccess" + fi + + # Create logs and temp directories if they don't exist + if [[ -d "logs" ]]; then + cp -r logs "$WEB_DIR/" || log "WARNING" "Failed to copy logs directory" + else + mkdir -p "$WEB_DIR/logs" || error_exit "Failed to create logs directory" + log "INFO" "Created logs directory" + fi + + if [[ -d "temp" ]]; then + cp -r temp "$WEB_DIR/" || log "WARNING" "Failed to copy temp directory" + else + mkdir -p "$WEB_DIR/temp" || error_exit "Failed to create temp directory" + log "INFO" "Created temp directory" + fi + # Set proper permissions chown -R "$WEB_USER:$WEB_USER" "$WEB_DIR" || error_exit "Failed to set ownership" chmod -R 755 "$WEB_DIR" || error_exit "Failed to set permissions" diff --git a/UI/logs/.gitkeep b/UI/logs/.gitkeep new file mode 100644 index 0000000..436f8a6 --- /dev/null +++ b/UI/logs/.gitkeep @@ -0,0 +1,2 @@ +# This file ensures the logs directory is included in git +# Log files will be created here during runtime diff --git a/UI/temp/.gitkeep b/UI/temp/.gitkeep new file mode 100644 index 0000000..6b6e0b0 --- /dev/null +++ b/UI/temp/.gitkeep @@ -0,0 +1,2 @@ +# This file ensures the temp directory is included in git +# Temporary files will be created here during runtime