docs: Add 2, update 5 and remove 1 files
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 45s

This commit is contained in:
Your Name
2025-09-11 20:53:06 +12:00
parent de9e57d795
commit 7c7c60e969
7 changed files with 343 additions and 40 deletions

View File

@@ -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