#!/bin/bash set -uo pipefail # Finishes setting a classroom machine up: the things that need the # network and the apt lock, and so cannot run from the package postinst. # # Run from ekklesia-classroom-provision.service at every boot. Each step # checks whether it is already done and returns immediately if so, so a # provisioned machine costs nothing, and a machine that was offline the # first time gets another go at the next boot. # # Nothing here is allowed to fail the boot. A classroom with no DVD # codecs is still a working classroom. log() { echo "[classroom-provision] $1" } log "starting" chrome_ok=true if /usr/local/bin/classroom-chrome-setup; then : else chrome_ok=false log "WARNING: Google Chrome is not installed yet." log "WARNING: Provisioning will retry automatically." fi # DVD codecs are only fetched for rooms that actually have a drive. if /usr/local/bin/classroom-dvd-css-setup --if-enabled; then : else log "WARNING: commercial DVD support is not set up. Unencrypted discs" log "WARNING: still play. Retrying at the next boot, or run:" log "WARNING: sudo classroom-dvd-css-setup" fi # The site printer is configured entirely through the local CUPS scheduler; # its being powered off or unreachable does not matter. Still bound the whole # step so a broken scheduler can never hold classroom provisioning open. if timeout --signal=TERM --kill-after=5s 30s \ /usr/local/bin/classroom-printer-setup; then : else log "WARNING: the Elmer printer queue is not configured." log "WARNING: Provisioning will try again at the next boot, or run:" log "WARNING: sudo classroom-printer-setup" fi log "finished" # Provisioning is best-effort by design. # Chrome is required for a usable classroom. Returning failure here does # not block boot; systemd retries this oneshot service in the background. if [[ "$chrome_ok" != true ]]; then exit 1 fi exit 0