hotfix for telemetry hotfix for profiles config
Build and Deploy to K3s / test (push) Successful in 2m6s
Build and Deploy to K3s / lint (push) Successful in 1m33s
Build and Deploy to K3s / build-and-push (push) Successful in 5m35s
Build and Deploy to K3s / deploy (push) Failing after 8s

This commit is contained in:
2025-11-30 03:34:08 -08:00
parent d3f95b8c52
commit e0535a033b
8 changed files with 378 additions and 228 deletions
+25 -9
View File
@@ -13,9 +13,18 @@ echo "==================================="
SOCKTOP_HOME=$(eval echo ~socktop)
echo "Socktop HOME: ${SOCKTOP_HOME}"
# Create necessary directories in the actual HOME
mkdir -p "${SOCKTOP_HOME}/.config/socktop/certs"
mkdir -p "${SOCKTOP_HOME}/.config/alacritty"
# Check if we're running as root
if [ "$(id -u)" -eq 0 ]; then
echo "Running as root, will set permissions"
# Create necessary directories in the actual HOME
mkdir -p "${SOCKTOP_HOME}/.config/socktop/certs"
mkdir -p "${SOCKTOP_HOME}/.config/alacritty"
else
echo "Running as non-root user ($(id -u)), creating directories without root"
# Try to create directories - will work if HOME is writable
mkdir -p "${SOCKTOP_HOME}/.config/socktop/certs" 2>/dev/null || echo " ⚠ Could not create directories (may already exist)"
mkdir -p "${SOCKTOP_HOME}/.config/alacritty" 2>/dev/null || true
fi
# Copy files from mounted locations to actual HOME if they exist
echo "Copying configuration files..."
@@ -56,8 +65,11 @@ else
echo " No certificates directory found (optional)"
fi
# Set proper ownership
chown -R socktop:socktop "${SOCKTOP_HOME}/.config"
# Set proper ownership (only if running as root)
if [ "$(id -u)" -eq 0 ]; then
chown -R socktop:socktop "${SOCKTOP_HOME}/.config"
echo " ✓ Set ownership to socktop:socktop"
fi
# Fix paths in profiles.json if it exists
if [ -f "${SOCKTOP_HOME}/.config/socktop/profiles.json" ]; then
@@ -70,7 +82,11 @@ fi
echo "==================================="
echo "Configuration initialization complete"
echo "==================================="
echo "Switching to socktop user..."
# Switch to socktop user and execute the main command
exec runuser -u socktop -- "$@"
# Switch to socktop user only if running as root
if [ "$(id -u)" -eq 0 ]; then
echo "Switching to socktop user..."
exec runuser -u socktop -- "$@"
else
echo "Already running as non-root user ($(whoami)), continuing..."
exec "$@"
fi