#!/bin/bash # shellcheck disable=SC1091 source "${AGENT_PATH}/common.sh" _check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" "KIOSK_URL" "KIOSK_USER" # Check if URL is set if [ -z "$KIOSK_URL" ] || [ "$KIOSK_URL" = "" ]; then _die "KIOSK_URL is not set in config/service.env! Please set the URL to display." fi # Check if user is set if [ -z "$KIOSK_USER" ] || [ "$KIOSK_USER" = "" ]; then _die "KIOSK_USER is not set in config/service.env! Please set the user account for the kiosk." fi _check_docker_installed || _die "Docker test failed, aborting installation..." echo "Installing Squash Display kiosk service..." 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" echo " - Configuring display settings" echo "" read -p "Do you want to continue? (yes/no): " confirmation if [ "$confirmation" != "yes" ]; then echo "Installation cancelled." exit 0 fi echo "Pulling Docker image..." docker pull "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || _die "Failed to pull image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" # Stop and remove existing container if it exists if _is_container_exists "$CONTAINER_NAME"; then echo "Removing existing container..." bash ./stop.sh 2>/dev/null || true _remove_container "$CONTAINER_NAME" || true fi # Make scripts executable chmod +x ${SERVICE_PATH}/scripts/*.sh # Start the setup container bash ./start.sh || _die "Failed to start Squash Display setup" echo "" echo "==========================================" echo "Squash Display installation complete!" echo "==========================================" echo "" echo "Next steps:" echo "1. REBOOT THE SYSTEM for all changes to take effect" echo " sudo reboot" echo "" echo "2. After reboot, the system will:" echo " - Auto-login as user: ${KIOSK_USER}" echo " - Start X server automatically" echo " - Launch Chromium in kiosk mode" echo " - Display: ${KIOSK_URL}" echo "" echo "3. To check status: ds status [server] squashdisplay" echo "4. To reconfigure: ds exec [server] squashdisplay configure" echo "" echo "Troubleshooting:" echo "- Check logs: journalctl -u getty@tty1" echo "- View X server logs: cat /home/${KIOSK_USER}/.local/share/xorg/Xorg.0.log" echo "- Manual test: sudo -u ${KIOSK_USER} startx /home/${KIOSK_USER}/kiosk.sh"