feat: Enhance log file setup in test-setup.sh for better container support and directory management

This commit is contained in:
Peter Wood
2025-05-28 11:44:38 -04:00
parent c76024e6e5
commit f7542cdb3f

View File

@@ -16,7 +16,22 @@ NC='\033[0m' # No Color
MAX_INSTALL_ATTEMPTS=3
CURRENT_ATTEMPT=1
# Log file setup - Try to use /logs directory if it doesn't exist and is writable
# Log file
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
CONTAINER_INFO=""
if [ -f /.dockerenv ]; then
# We're in a container, try to get container info
if [ -f /etc/os-release ]; then
CONTAINER_INFO="$(grep '^ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"')-"
fi
fi
# Create logs directory if it doesn't exist
LOGS_DIR="/tmp"
if [ ! -d "$LOGS_DIR" ]; then
mkdir -p "$LOGS_DIR"
fi
firectory if it doesn't exist and is writable
# First, try creating the logs directory in case it doesn't exist
if [ -d "/logs" ] || mkdir -p /logs 2>/dev/null; then
if [ -w "/logs" ]; then