diff --git a/squashdisplay/README.txt b/squashdisplay/README.txt index 8e428c5..7a758d0 100644 --- a/squashdisplay/README.txt +++ b/squashdisplay/README.txt @@ -9,11 +9,14 @@ installing packages, configuring auto-login, and modifying system services. REQUIREMENTS ------------ -* Raspberry Pi or Linux system with HDMI output -* Fresh Raspberry Pi OS Lite installation (recommended) +* Supported systems: + - Raspberry Pi with Raspberry Pi OS + - Intel Mac Mini with Ubuntu Server + - Other x86_64 systems with Ubuntu * Docker installed (for running setup) * Internet connection for package installation * Target URL to display +* HDMI or DisplayPort output WHAT IT DOES ------------ @@ -22,10 +25,12 @@ This template automates the complete kiosk setup process: 2. Creates/configures kiosk user account 3. Sets up auto-login on boot 4. Configures X server to start automatically -5. Launches Chromium in kiosk mode +5. Launches Chromium/Chrome in kiosk mode 6. Disables screen blanking and power management 7. Optional watchdog to restart browser if it crashes -8. Configures GPU memory for better performance (RPi) +8. System-specific optimizations: + - Raspberry Pi: GPU memory allocation, update disabling + - Ubuntu/Mac Mini: Intel GPU optimizations CONFIGURATION ------------- @@ -42,11 +47,16 @@ Key settings in service.env: INSTALLATION ------------ 1. Configure your settings in the service configuration -2. Run: ./install.sh +2. Run: ./install.sh (will auto-detect system type) 3. Confirm system modifications when prompted 4. REBOOT the system: sudo reboot 5. System will auto-start in kiosk mode +The installer will automatically detect if you're running on: +- Raspberry Pi (ARM-based) +- Ubuntu on x86_64 (Mac Mini or PC) +If detection fails, you'll be prompted to select manually. + The installation uses a privileged Docker container to make the necessary system changes. This is intentional and required. diff --git a/squashdisplay/configure.sh b/squashdisplay/configure-rpi.sh similarity index 100% rename from squashdisplay/configure.sh rename to squashdisplay/configure-rpi.sh diff --git a/squashdisplay/configure-ubuntu.sh b/squashdisplay/configure-ubuntu.sh new file mode 100755 index 0000000..b633dcf --- /dev/null +++ b/squashdisplay/configure-ubuntu.sh @@ -0,0 +1,164 @@ +#!/bin/bash +# shellcheck disable=SC1091 +source "${AGENT_PATH}/common.sh" +_check_required_env_vars "KIOSK_USER" "KIOSK_URL" + +# Squash Display Configure Script for Ubuntu - Update kiosk settings + +echo "Squash Display Configuration Update (Ubuntu)" +echo "============================================" + +echo "" +echo "This will update the kiosk configuration with current settings:" +echo " URL: ${KIOSK_URL}" +echo " Display: ${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}@${DISPLAY_REFRESH}Hz" +echo "" + +# Update kiosk.sh script +if [ -f "/home/${KIOSK_USER}/kiosk.sh" ]; then + echo "Updating kiosk script..." + + # Create updated script + cat <<'EOF' | sudo tee /home/${KIOSK_USER}/kiosk.sh.new > /dev/null +#!/bin/bash + +# Disable screen blanking and power management +xset s noblank +xset s off +xset -dpms + +# Hide cursor after 1 second of inactivity +unclutter -idle 1 & + +# Force display resolution +# Ubuntu on Mac Mini typically uses DisplayPort or HDMI +xrandr --output DP-1 --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || \ +xrandr --output DP-2 --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || \ +xrandr --output HDMI-1 --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || \ +xrandr --output HDMI-2 --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || \ +xrandr --output eDP-1 --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || \ +xrandr --output default --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || true + +# Start Chromium in kiosk mode +# Try chromium-browser first, then chromium, then google-chrome +if command -v chromium-browser >/dev/null 2>&1; then + BROWSER="chromium-browser" +elif command -v chromium >/dev/null 2>&1; then + BROWSER="chromium" +elif command -v google-chrome >/dev/null 2>&1; then + BROWSER="google-chrome" +else + echo "No Chromium-based browser found!" + exit 1 +fi + +$BROWSER \ + --window-size=DISPLAY_WIDTH_PLACEHOLDER,DISPLAY_HEIGHT_PLACEHOLDER \ + --window-position=0,0 \ + --noerrdialogs \ + --disable-infobars \ + --disable-features=TranslateUI \ + --disable-extensions \ + --disable-plugins \ + --disable-web-security \ + --disable-features=VizDisplayCompositor \ + --start-fullscreen \ + --kiosk \ + --incognito \ + --no-first-run \ + --fast \ + --fast-start \ + --disable-default-apps \ + --disable-translate \ + --disable-background-timer-throttling \ + --disable-renderer-backgrounding \ + --disable-backgrounding-occluded-windows \ + --disable-component-extensions-with-background-pages \ + --autoplay-policy=no-user-gesture-required \ + --enable-accelerated-video-decode \ + --enable-gpu-rasterization \ + --enable-oop-rasterization \ + "KIOSK_URL_PLACEHOLDER" +EOF + + # Replace placeholders with actual values + sudo sed -i "s|DISPLAY_WIDTH_PLACEHOLDER|${DISPLAY_WIDTH}|g" /home/${KIOSK_USER}/kiosk.sh.new + sudo sed -i "s|DISPLAY_HEIGHT_PLACEHOLDER|${DISPLAY_HEIGHT}|g" /home/${KIOSK_USER}/kiosk.sh.new + sudo sed -i "s|DISPLAY_REFRESH_PLACEHOLDER|${DISPLAY_REFRESH}|g" /home/${KIOSK_USER}/kiosk.sh.new + sudo sed -i "s|KIOSK_URL_PLACEHOLDER|${KIOSK_URL}|g" /home/${KIOSK_USER}/kiosk.sh.new + + # Replace old script + sudo mv /home/${KIOSK_USER}/kiosk.sh.new /home/${KIOSK_USER}/kiosk.sh + sudo chmod +x /home/${KIOSK_USER}/kiosk.sh + sudo chown ${KIOSK_USER}:${KIOSK_USER} /home/${KIOSK_USER}/kiosk.sh + + echo "✓ Kiosk script updated" +else + echo "✗ Kiosk script not found at /home/${KIOSK_USER}/kiosk.sh" + echo " Run installation first: ./install.sh" + exit 1 +fi + +# Update GRUB for better performance on Mac Mini (if applicable) +if [ -f "/etc/default/grub" ] && grep -q "Ubuntu" /etc/os-release; then + echo "Checking GRUB configuration for optimal performance..." + + # Check if we need to add Intel graphics parameters + if ! grep -q "i915.enable_guc=2" /etc/default/grub; then + echo "Adding Intel GPU optimizations to GRUB..." + sudo cp /etc/default/grub /etc/default/grub.backup + + # Add Intel GPU parameters for better performance + CURRENT_CMDLINE=$(grep "^GRUB_CMDLINE_LINUX_DEFAULT=" /etc/default/grub | cut -d'"' -f2) + NEW_CMDLINE="${CURRENT_CMDLINE} i915.enable_guc=2 i915.enable_fbc=1" + sudo sed -i "s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"${NEW_CMDLINE}\"/" /etc/default/grub + + echo "✓ GRUB configuration updated" + echo " Note: Run 'sudo update-grub' and reboot to apply changes" + fi +fi + +# Restart kiosk if it's running +if pgrep -f "chromium.*--kiosk\|chrome.*--kiosk" >/dev/null 2>&1; then + echo "" + echo "Restarting kiosk with new configuration..." + + # Kill existing browser process + pkill -f "chromium.*--kiosk\|chrome.*--kiosk" + + # Give it a moment + sleep 2 + + # If watchdog is enabled, it will restart automatically + if [ "${ENABLE_WATCHDOG}" = "true" ]; then + echo "Watchdog will restart the kiosk automatically..." + else + # Manual restart + echo "Starting kiosk manually..." + sudo -u ${KIOSK_USER} DISPLAY=:0 /home/${KIOSK_USER}/kiosk.sh & + fi + + echo "✓ Kiosk restarted with new configuration" +else + echo "" + echo "Kiosk is not currently running." + echo "Configuration will be applied on next start." +fi + +echo "" +echo "Configuration update complete!" +echo "" +echo "Current settings:" +echo " URL: ${KIOSK_URL}" +echo " Display: ${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}@${DISPLAY_REFRESH}Hz" +echo "" + +# Check if GRUB was updated +if [ -f "/etc/default/grub.backup" ]; then + echo "Important: GRUB was updated for better GPU performance." + echo "Run these commands to apply the changes:" + echo " sudo update-grub" + echo " sudo reboot" +else + echo "To apply all changes, you may need to reboot: sudo reboot" +fi \ No newline at end of file diff --git a/squashdisplay/install.sh b/squashdisplay/install.sh index 4a92c5f..ef0abeb 100755 --- a/squashdisplay/install.sh +++ b/squashdisplay/install.sh @@ -15,14 +15,63 @@ fi _check_docker_installed || _die "Docker test failed, aborting installation..." -echo "Installing Squash Display kiosk service..." +# Detect system type +echo "Detecting system type..." +SYSTEM_TYPE="" +if [ -f "/proc/device-tree/model" ]; then + MODEL=$(cat /proc/device-tree/model 2>/dev/null | tr -d '\0') + if echo "$MODEL" | grep -qi "raspberry"; then + SYSTEM_TYPE="rpi" + echo " Detected: Raspberry Pi ($MODEL)" + fi +fi + +if [ -z "$SYSTEM_TYPE" ]; then + # Check for Ubuntu on x86_64 (likely Mac Mini or standard PC) + if [ -f "/etc/os-release" ]; then + . /etc/os-release + if [ "$ID" = "ubuntu" ] && [ "$(uname -m)" = "x86_64" ]; then + SYSTEM_TYPE="ubuntu" + echo " Detected: Ubuntu on x86_64" + # Try to detect if it's a Mac Mini + if command -v dmidecode >/dev/null 2>&1; then + PRODUCT=$(sudo dmidecode -s system-product-name 2>/dev/null || true) + if echo "$PRODUCT" | grep -qi "mac"; then + echo " Hardware: Mac Mini" + fi + fi + elif [ "$ID" = "raspbian" ] || [ "$ID" = "debian" ] && [ "$(uname -m)" = "aarch64" -o "$(uname -m)" = "armv7l" ]; then + SYSTEM_TYPE="rpi" + echo " Detected: Raspberry Pi OS" + fi + fi +fi + +if [ -z "$SYSTEM_TYPE" ]; then + echo " Could not auto-detect system type." + echo " Please select your system:" + echo " 1) Raspberry Pi" + echo " 2) Ubuntu (x86_64/Mac Mini)" + read -p " Enter choice (1 or 2): " choice + case $choice in + 1) SYSTEM_TYPE="rpi" ;; + 2) SYSTEM_TYPE="ubuntu" ;; + *) _die "Invalid choice. Installation cancelled." ;; + esac +fi + +echo "" +echo "Installing Squash Display kiosk service for $SYSTEM_TYPE..." echo "" echo "WARNING: This will make system-level changes to configure kiosk mode." echo "Changes include:" echo " - Installing Chromium browser and X server packages" echo " - Configuring auto-login for user: ${KIOSK_USER}" echo " - Setting up kiosk scripts" -echo " - Disabling automatic updates" +if [ "$SYSTEM_TYPE" = "rpi" ]; then + echo " - Configuring GPU memory allocation" + echo " - Disabling automatic updates" +fi echo " - Configuring display settings" echo "" @@ -47,6 +96,9 @@ if _is_container_exists "$CONTAINER_NAME"; then _remove_container "$CONTAINER_NAME" || true fi +# Export SYSTEM_TYPE for use in start.sh +export SYSTEM_TYPE + # Start the setup container (scripts are now embedded in start.sh) bash ./start.sh || _die "Failed to start Squash Display setup" diff --git a/squashdisplay/setup.sh b/squashdisplay/setup.sh index ccb6598..65f3472 100755 --- a/squashdisplay/setup.sh +++ b/squashdisplay/setup.sh @@ -19,8 +19,10 @@ GPU_MEM="${GPU_MEM:-256}" ENABLE_WATCHDOG="${ENABLE_WATCHDOG:-true}" ENABLE_AUTO_LOGIN="${ENABLE_AUTO_LOGIN:-true}" ENABLE_HDMI_KEEP_ALIVE="${ENABLE_HDMI_KEEP_ALIVE:-true}" +SYSTEM_TYPE="${SYSTEM_TYPE:-rpi}" echo "Configuration:" +echo " System: ${SYSTEM_TYPE}" echo " URL: ${KIOSK_URL}" echo " User: ${KIOSK_USER}" echo " Display: ${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}@${DISPLAY_REFRESH}Hz" @@ -28,8 +30,22 @@ echo " Display: ${DISPLAY_WIDTH}x${DISPLAY_HEIGHT}@${DISPLAY_REFRESH}Hz" # Install required packages echo "Installing required packages..." host_exec apt-get update -host_exec apt-get install -y chromium-browser xorg xinit x11-xserver-utils unclutter || \ -host_exec apt-get install -y chromium xorg xinit x11-xserver-utils unclutter + +if [ "${SYSTEM_TYPE}" = "ubuntu" ]; then + # Ubuntu packages - try multiple browser options + host_exec apt-get install -y xorg xinit x11-xserver-utils unclutter + host_exec apt-get install -y chromium-browser || \ + host_exec apt-get install -y chromium || \ + host_exec sh -c "wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ + echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/google-chrome.list && \ + apt-get update && \ + apt-get install -y google-chrome-stable" || \ + echo "Warning: Could not install Chrome/Chromium" +else + # Raspberry Pi packages + host_exec apt-get install -y chromium-browser xorg xinit x11-xserver-utils unclutter || \ + host_exec apt-get install -y chromium xorg xinit x11-xserver-utils unclutter +fi # Create kiosk user if it doesn't exist if ! host_exec id -u ${KIOSK_USER} >/dev/null 2>&1; then @@ -67,12 +83,35 @@ xset -dpms unclutter -idle 1 & # Force display resolution -xrandr --output HDMI-1 --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || \ -xrandr --output HDMI-2 --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || \ -xrandr --output default --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || true +if [ "SYSTEM_TYPE_PLACEHOLDER" = "ubuntu" ]; then + # Ubuntu/Mac Mini typically uses DisplayPort or HDMI + xrandr --output DP-1 --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || \ + xrandr --output DP-2 --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || \ + xrandr --output HDMI-1 --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || \ + xrandr --output HDMI-2 --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || \ + xrandr --output eDP-1 --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || \ + xrandr --output default --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || true +else + # Raspberry Pi typically uses HDMI + xrandr --output HDMI-1 --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || \ + xrandr --output HDMI-2 --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || \ + xrandr --output default --mode DISPLAY_WIDTH_PLACEHOLDERxDISPLAY_HEIGHT_PLACEHOLDER --rate DISPLAY_REFRESH_PLACEHOLDER 2>/dev/null || true +fi # Start Chromium in kiosk mode -chromium-browser \ +# Try to find available browser +if command -v chromium-browser >/dev/null 2>&1; then + BROWSER="chromium-browser" +elif command -v chromium >/dev/null 2>&1; then + BROWSER="chromium" +elif command -v google-chrome >/dev/null 2>&1; then + BROWSER="google-chrome" +else + echo "No Chromium-based browser found!" + exit 1 +fi + +$BROWSER \ --window-size=DISPLAY_WIDTH_PLACEHOLDER,DISPLAY_HEIGHT_PLACEHOLDER \ --window-position=0,0 \ --noerrdialogs \ @@ -103,6 +142,7 @@ sed -i "s|DISPLAY_WIDTH_PLACEHOLDER|${DISPLAY_WIDTH}|g" /tmp/kiosk.sh sed -i "s|DISPLAY_HEIGHT_PLACEHOLDER|${DISPLAY_HEIGHT}|g" /tmp/kiosk.sh sed -i "s|DISPLAY_REFRESH_PLACEHOLDER|${DISPLAY_REFRESH}|g" /tmp/kiosk.sh sed -i "s|KIOSK_URL_PLACEHOLDER|${KIOSK_URL}|g" /tmp/kiosk.sh +sed -i "s|SYSTEM_TYPE_PLACEHOLDER|${SYSTEM_TYPE}|g" /tmp/kiosk.sh host_exec cp /tmp/kiosk.sh /home/${KIOSK_USER}/kiosk.sh host_exec chmod +x /home/${KIOSK_USER}/kiosk.sh @@ -147,24 +187,43 @@ BASHRC host_exec sh -c "cat /tmp/bashrc_append >> /home/${KIOSK_USER}/.bashrc" fi -# Disable automatic updates -echo "Disabling automatic updates..." -host_exec systemctl disable apt-daily.service 2>/dev/null || true -host_exec systemctl disable apt-daily.timer 2>/dev/null || true -host_exec systemctl disable apt-daily-upgrade.timer 2>/dev/null || true -host_exec systemctl disable apt-daily-upgrade.service 2>/dev/null || true +# Disable automatic updates (RPi only, keep updates on Ubuntu) +if [ "${SYSTEM_TYPE}" = "rpi" ]; then + echo "Disabling automatic updates..." + host_exec systemctl disable apt-daily.service 2>/dev/null || true + host_exec systemctl disable apt-daily.timer 2>/dev/null || true + host_exec systemctl disable apt-daily-upgrade.timer 2>/dev/null || true + host_exec systemctl disable apt-daily-upgrade.service 2>/dev/null || true +fi # Configure GPU memory split (Raspberry Pi specific) -if host_exec test -f /boot/firmware/config.txt || host_exec test -f /boot/config.txt; then - echo "Configuring GPU memory split..." - CONFIG_FILE="/boot/firmware/config.txt" - host_exec test -f /boot/config.txt && CONFIG_FILE="/boot/config.txt" - - if ! host_exec grep -q "^gpu_mem=" ${CONFIG_FILE}; then - echo "gpu_mem=${GPU_MEM}" > /tmp/gpu_mem - host_exec sh -c "cat /tmp/gpu_mem >> ${CONFIG_FILE}" - else - host_exec sed -i "s/^gpu_mem=.*/gpu_mem=${GPU_MEM}/" ${CONFIG_FILE} +if [ "${SYSTEM_TYPE}" = "rpi" ]; then + if host_exec test -f /boot/firmware/config.txt || host_exec test -f /boot/config.txt; then + echo "Configuring GPU memory split..." + CONFIG_FILE="/boot/firmware/config.txt" + host_exec test -f /boot/config.txt && CONFIG_FILE="/boot/config.txt" + + if ! host_exec grep -q "^gpu_mem=" ${CONFIG_FILE}; then + echo "gpu_mem=${GPU_MEM}" > /tmp/gpu_mem + host_exec sh -c "cat /tmp/gpu_mem >> ${CONFIG_FILE}" + else + host_exec sed -i "s/^gpu_mem=.*/gpu_mem=${GPU_MEM}/" ${CONFIG_FILE} + fi + fi +fi + +# Configure Intel GPU optimizations (Ubuntu/Mac Mini specific) +if [ "${SYSTEM_TYPE}" = "ubuntu" ]; then + if host_exec test -f /etc/default/grub; then + echo "Checking GPU optimizations..." + if ! host_exec grep -q "i915.enable_guc=2" /etc/default/grub; then + echo "Adding Intel GPU optimizations..." + host_exec cp /etc/default/grub /etc/default/grub.backup + CURRENT_CMDLINE=$(host_exec grep "^GRUB_CMDLINE_LINUX_DEFAULT=" /etc/default/grub | cut -d'"' -f2) + NEW_CMDLINE="${CURRENT_CMDLINE} i915.enable_guc=2 i915.enable_fbc=1" + host_exec sed -i "s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"${NEW_CMDLINE}\"/" /etc/default/grub + echo "Note: Run 'sudo update-grub' after reboot to apply GPU optimizations" + fi fi fi diff --git a/squashdisplay/start.sh b/squashdisplay/start.sh index 5ac44e8..bf16ac5 100755 --- a/squashdisplay/start.sh +++ b/squashdisplay/start.sh @@ -30,6 +30,23 @@ ENABLE_WATCHDOG="${ENABLE_WATCHDOG:-true}" ENABLE_AUTO_LOGIN="${ENABLE_AUTO_LOGIN:-true}" ENABLE_HDMI_KEEP_ALIVE="${ENABLE_HDMI_KEEP_ALIVE:-true}" +# Get system type from environment or try to detect it +if [ -z "$SYSTEM_TYPE" ]; then + # Auto-detect if not provided + if [ -f "/proc/device-tree/model" ] && grep -qi "raspberry" /proc/device-tree/model 2>/dev/null; then + SYSTEM_TYPE="rpi" + elif [ -f "/etc/os-release" ]; then + . /etc/os-release + if [ "$ID" = "ubuntu" ] && [ "$(uname -m)" = "x86_64" ]; then + SYSTEM_TYPE="ubuntu" + elif [ "$ID" = "raspbian" ] || ([ "$ID" = "debian" ] && ([ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "armv7l" ])); then + SYSTEM_TYPE="rpi" + fi + fi + # Default to rpi if still not detected + SYSTEM_TYPE="${SYSTEM_TYPE:-rpi}" +fi + # Build the docker run command - needs privileged access to configure host # Using --env-file to avoid quoting issues cat > /tmp/squashdisplay.env << EOF @@ -42,6 +59,7 @@ GPU_MEM=${GPU_MEM} ENABLE_WATCHDOG=${ENABLE_WATCHDOG} ENABLE_AUTO_LOGIN=${ENABLE_AUTO_LOGIN} ENABLE_HDMI_KEEP_ALIVE=${ENABLE_HDMI_KEEP_ALIVE} +SYSTEM_TYPE=${SYSTEM_TYPE} EOF DOCKER_RUN_CMD="docker run -d \ diff --git a/squashdisplay/status.sh b/squashdisplay/status.sh index 2423522..cd86a80 100755 --- a/squashdisplay/status.sh +++ b/squashdisplay/status.sh @@ -57,10 +57,10 @@ else fi # Check if Chromium is installed -if command -v chromium-browser >/dev/null 2>&1 || command -v chromium >/dev/null 2>&1; then - echo "✓ Chromium browser installed" +if command -v chromium-browser >/dev/null 2>&1 || command -v chromium >/dev/null 2>&1 || command -v google-chrome >/dev/null 2>&1; then + echo "✓ Chromium/Chrome browser installed" else - echo "✗ Chromium browser not installed" + echo "✗ Chromium/Chrome browser not installed" fi # Check if X server is installed @@ -70,22 +70,22 @@ else echo "✗ X server not installed" fi -# Check for running Chromium process +# Check for running browser process echo "" echo "Kiosk Process Status:" echo "--------------------" -if pgrep -f "chromium.*--kiosk" >/dev/null 2>&1; then - echo "✓ Chromium kiosk is running" - CHROMIUM_PID=$(pgrep -f "chromium.*--kiosk" | head -1) - echo " PID: ${CHROMIUM_PID}" +if pgrep -f "chromium.*--kiosk\|chrome.*--kiosk" >/dev/null 2>&1; then + echo "✓ Browser kiosk is running" + BROWSER_PID=$(pgrep -f "chromium.*--kiosk\|chrome.*--kiosk" | head -1) + echo " PID: ${BROWSER_PID}" # Try to get the URL being displayed - if [ -n "$CHROMIUM_PID" ]; then - CMDLINE=$(ps -p ${CHROMIUM_PID} -o args= 2>/dev/null | grep -oE 'https?://[^ ]+' | head -1) + if [ -n "$BROWSER_PID" ]; then + CMDLINE=$(ps -p ${BROWSER_PID} -o args= 2>/dev/null | grep -oE 'https?://[^ ]+' | head -1) [ -n "$CMDLINE" ] && echo " URL: ${CMDLINE}" fi else - echo "✗ Chromium kiosk is not running" + echo "✗ Browser kiosk is not running" echo " This is normal if the system hasn't been rebooted after installation" fi