#!/bin/sh # The nRF9151 station's X session: the front end, full screen under matchbox-wm. # The station image selects this as x-session-manager, so /etc/X11/Xsession runs # it in place of a desktop session. # # The front end's own output, and every command it runs, goes to # /tmp/nrf-station-ui.log. It is started again if it ever exits; the console # beside the session keeps working either way. LOG=/tmp/nrf-station-ui.log # A session without a display has nothing to run; a stray call (with --version, # say) must not start the front end's restart loop. [ -n "${DISPLAY:-}" ] || { echo "nrf-station-session: no DISPLAY; this is an X session" >&2; exit 1; } # BRINTOS-WORKAROUND: brintos/linux#153 remove -- programs started together can take each other's staged libraries; staging the window manager's and the front end's once, one after the other, before either starts leaves nothing to race on. # No DISPLAY, so a program that does not know --version refuses rather than runs. env -u DISPLAY /usr/bin/matchbox-window-manager --version /dev/null 2>&1 env -u DISPLAY /usr/bin/nrf-station-ui --version /dev/null 2>&1 up() { read -r u _ < /proc/uptime; echo "${u%.*}"; } ( fast=0 while [ "$fast" -lt 3 ]; do t0=$(up) /usr/bin/nrf-station-ui --announce /dev/console echo "nrf-station-ui exited with status $? at uptime $(up) s" if [ $(( $(up) - t0 )) -lt 10 ]; then fast=$((fast + 1)); else fast=0; fi done echo "nrf-station-ui: stopped restarting it after three quick exits" | tee /dev/console ) >>"$LOG" 2>&1 & # The image ships no fontconfig cache and its root is read-only, so the window # manager's font setup would rescan every font and never finish: it gets one # font and a cache it can write. FC=/tmp/nrf-station-fc mkdir -p "$FC/fonts" "$FC/cache" ln -sf /usr/share/fonts/X11/misc/6x13-ISO8859-1.pcf.gz "$FC/fonts/" cat > "$FC/fonts.conf" < $FC/fonts$FC/cache EOF FONTCONFIG_FILE="$FC/fonts.conf" exec matchbox-window-manager -use_titlebar no -use_cursor yes