#!/bin/bash # rc.local for the OneFinity Pi, "fast" variant. # # What changed vs. scripts/rc.local: # - bbserial unbind/rebind moved to bbserial-rebind.service (runs # once, before bbctrl, instead of after bbctrl is already # listening on the serial port). # - startx moved to kiosk.service so chromium starts in parallel # with bbctrl rather than blocking on rc.local. # - rc.local no longer keeps the Pi in 'starting' state forever, # which fixes systemd-analyze. set -e # Mount /boot read only mount -o remount,ro /boot 2>/dev/null || true # Set SPI GPIO mode gpio mode 27 alt3 || true # Create browser memory limited cgroup if [ -d /sys/fs/cgroup/memory ]; then CGROUP=/sys/fs/cgroup/memory/chrome [ -d "$CGROUP" ] || mkdir -p "$CGROUP" chown -R pi:pi "$CGROUP" echo 650000000 > "$CGROUP/memory.soft_limit_in_bytes" echo 750000000 > "$CGROUP/memory.limit_in_bytes" fi # Stop boot splash; harmless if plymouth already gone. plymouth quit 2>/dev/null || true # Start X (chromium kiosk) in the background so rc.local can exit and # late-boot units (bbctrl logrotate, etc.) don't block on it. Output # is redirected so the journal doesn't fill up with X warnings. cd /home/pi # `-- -nocursor` hides the X pointer; this is a touchscreen kiosk and # the mouse cursor only gets in the way. nohup sudo -u pi startx -- -nocursor >/var/log/onefin-x.log 2>&1 & disown exit 0