From 7c83717ca8a7cd36606f38db5703561a6d87fd75 Mon Sep 17 00:00:00 2001 From: Chuck <33324927+ChuckBuilds@users.noreply.github.com> Date: Mon, 21 Jul 2025 21:54:16 -0500 Subject: [PATCH] trying to fix permission errors --- fix_cache_permissions.sh | 63 +++++++++++++++++++--------------------- src/ncaa_fb_managers.py | 2 +- 2 files changed, 31 insertions(+), 34 deletions(-) diff --git a/fix_cache_permissions.sh b/fix_cache_permissions.sh index dbb29e9f..b7959841 100644 --- a/fix_cache_permissions.sh +++ b/fix_cache_permissions.sh @@ -1,45 +1,42 @@ #!/bin/bash # LEDMatrix Cache Permissions Fix Script -# This script fixes permissions on the cache directory so it's writable by the daemon user +# This script fixes permissions on all known cache directories so they're writable by the daemon or current user echo "Fixing LEDMatrix cache directory permissions..." -CACHE_DIR="/var/cache/ledmatrix" - -if [ ! -d "$CACHE_DIR" ]; then - echo "Cache directory does not exist. Run setup_cache.sh first." - exit 1 -fi +CACHE_DIRS=( + "/var/cache/ledmatrix" + "/home/ledpi/.ledmatrix_cache" +) # Get the real user (not root when running with sudo) REAL_USER=${SUDO_USER:-$USER} +REAL_GROUP=$(id -gn "$REAL_USER") -echo "Current cache directory permissions:" -ls -la "$CACHE_DIR" +for CACHE_DIR in "${CACHE_DIRS[@]}"; do + echo "" + echo "Checking cache directory: $CACHE_DIR" + if [ ! -d "$CACHE_DIR" ]; then + echo " - Directory does not exist. Skipping." + continue + fi + echo " - Current permissions:" + ls -ld "$CACHE_DIR" + echo " - Fixing permissions..." + sudo chmod 777 "$CACHE_DIR" + sudo chown "$REAL_USER":"$REAL_GROUP" "$CACHE_DIR" + echo " - Updated permissions:" + ls -ld "$CACHE_DIR" + echo " - Testing write access as $REAL_USER..." + if sudo -u "$REAL_USER" test -w "$CACHE_DIR"; then + echo " ✓ $CACHE_DIR is now writable by $REAL_USER" + else + echo " ✗ $CACHE_DIR is still not writable by $REAL_USER" + fi + echo " - Permissions fix complete for $CACHE_DIR." +done echo "" -echo "Fixing permissions..." - -# Make the directory writable by the daemon user (which the system runs as) -sudo chmod 777 "$CACHE_DIR" - -# Also set ownership to daemon:daemon to match the cache files -sudo chown daemon:daemon "$CACHE_DIR" - -echo "" -echo "Updated cache directory permissions:" -ls -la "$CACHE_DIR" - -echo "" -echo "Testing write access..." -if sudo -u daemon test -w "$CACHE_DIR"; then - echo "✓ Cache directory is now writable by daemon user" -else - echo "✗ Cache directory is still not writable by daemon user" - exit 1 -fi - -echo "" -echo "Permissions fix complete! LEDMatrix should now use persistent caching." -echo "The cache will survive system restarts." \ No newline at end of file +echo "All cache directory permission fixes attempted." +echo "If you still see errors, check which user is running the LEDMatrix service and ensure it matches the owner above." \ No newline at end of file diff --git a/src/ncaa_fb_managers.py b/src/ncaa_fb_managers.py index edb17b6e..859ebf8a 100644 --- a/src/ncaa_fb_managers.py +++ b/src/ncaa_fb_managers.py @@ -89,7 +89,7 @@ class BaseNCAAFBManager: # Renamed class self.upcoming_enabled = display_modes.get("ncaa_fb_upcoming", False) self.live_enabled = display_modes.get("ncaa_fb_live", False) - self.logger.setLevel(logging.DEBUG) + self.logger.setLevel(logging.INFO) display_config = config.get("display", {}) hardware_config = display_config.get("hardware", {})