Files
reterminal-dm4/chromium-setup/emmc-provisioning/cloud-init/set-rotation-once.sh

16 lines
709 B
Bash

#!/bin/bash
# One-shot: set DSI-1 (reTerminal DM) rotation to Right, then remove self. Runs as user pi at first login.
# Logs to /var/log/first-boot.log (same as first-boot.sh).
FIRST_BOOT_LOG="/var/log/first-boot.log"
log() { echo "[$(date -Iseconds)] [set-rotation-once] $*" >> "$FIRST_BOOT_LOG" 2>/dev/null || true; }
export DISPLAY=:0
log "started (DISPLAY=$DISPLAY)"
log "waiting 5s for display ..."
sleep 5
log "running kscreen-doctor output.DSI-1.rotation.right"
kscreen-doctor output.DSI-1.rotation.right 2>&1 | while read -r line; do log "$line"; done
log "removing one-shot desktop and script"
rm -f /home/pi/.config/autostart/set-rotation-once.desktop /home/pi/set-rotation-once.sh
log "finished"