docs: Add 2, update 5 and remove 1 files
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 45s
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 45s
This commit is contained in:
164
squashdisplay/configure-ubuntu.sh
Executable file
164
squashdisplay/configure-ubuntu.sh
Executable file
@@ -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
|
Reference in New Issue
Block a user