mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 07:50:11 -08:00
feat: Enhance log file setup in test-setup.sh for better container support and directory management
This commit is contained in:
@@ -16,7 +16,22 @@ NC='\033[0m' # No Color
|
|||||||
MAX_INSTALL_ATTEMPTS=3
|
MAX_INSTALL_ATTEMPTS=3
|
||||||
CURRENT_ATTEMPT=1
|
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
|
# First, try creating the logs directory in case it doesn't exist
|
||||||
if [ -d "/logs" ] || mkdir -p /logs 2>/dev/null; then
|
if [ -d "/logs" ] || mkdir -p /logs 2>/dev/null; then
|
||||||
if [ -w "/logs" ]; then
|
if [ -w "/logs" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user