trying to fix permission errors

This commit is contained in:
Chuck
2025-07-21 21:54:16 -05:00
parent 580a71e6c5
commit 7c83717ca8
2 changed files with 31 additions and 34 deletions

View File

@@ -1,45 +1,42 @@
#!/bin/bash #!/bin/bash
# LEDMatrix Cache Permissions Fix Script # 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..." echo "Fixing LEDMatrix cache directory permissions..."
CACHE_DIR="/var/cache/ledmatrix" CACHE_DIRS=(
"/var/cache/ledmatrix"
if [ ! -d "$CACHE_DIR" ]; then "/home/ledpi/.ledmatrix_cache"
echo "Cache directory does not exist. Run setup_cache.sh first." )
exit 1
fi
# Get the real user (not root when running with sudo) # Get the real user (not root when running with sudo)
REAL_USER=${SUDO_USER:-$USER} REAL_USER=${SUDO_USER:-$USER}
REAL_GROUP=$(id -gn "$REAL_USER")
echo "Current cache directory permissions:" for CACHE_DIR in "${CACHE_DIRS[@]}"; do
ls -la "$CACHE_DIR" 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 ""
echo "Fixing permissions..." 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."
# 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."

View File

@@ -89,7 +89,7 @@ class BaseNCAAFBManager: # Renamed class
self.upcoming_enabled = display_modes.get("ncaa_fb_upcoming", False) self.upcoming_enabled = display_modes.get("ncaa_fb_upcoming", False)
self.live_enabled = display_modes.get("ncaa_fb_live", 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", {}) display_config = config.get("display", {})
hardware_config = display_config.get("hardware", {}) hardware_config = display_config.get("hardware", {})