fix install script4

This commit is contained in:
Edmund Tan 2025-07-22 02:07:51 +08:00
parent eda574ce42
commit 181884b931
3 changed files with 33 additions and 4 deletions

View File

@ -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"

2
UI/logs/.gitkeep Normal file
View File

@ -0,0 +1,2 @@
# This file ensures the logs directory is included in git
# Log files will be created here during runtime

2
UI/temp/.gitkeep Normal file
View File

@ -0,0 +1,2 @@
# This file ensures the temp directory is included in git
# Temporary files will be created here during runtime