omega-gpu-driver
aien-dev/omega-gpu-driver
Brought by drakestapleton
omega-gpu-driver / window / d2-boot.sh
| 1 | #!/bin/sh |
| 2 | # window/d2-boot.sh -- run once per boot by aien-owndriver-window.service. Status: NOT_RUN. |
| 3 | # state "run D2" / "run D3": the reboot from W1 has happened; run window/d2-run.sh --go STAGE. |
| 4 | # state "restore": the reboot from W7 (or a fallback) has happened; run window/d2-restore.sh --go. |
| 5 | # no state: nothing pending: remove the unit (a leftover unit must never act twice). |
| 6 | set -eu |
| 7 | R=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd) |
| 8 | . "$R/window/common.sh" |
| 9 | LOG=$LOGDIR/d2-$(date -u +%Y%m%dT%H%M%SZ)-boot.log |
| 10 | s=$(cat "$STATE" 2>/dev/null || true) |
| 11 | log "boot unit: state '$s'" |
| 12 | case $s in |
| 13 | "run W0" | "run D2" | "run D3") exec sh "$R/window/d2-run.sh" --go "${s#run }" ;; |
| 14 | "restore W0") exec sh "$R/window/d2-restore.sh" --go W0 ;; |
| 15 | restore) exec sh "$R/window/d2-restore.sh" --go ;; |
| 16 | *) |
| 17 | sudo -n systemctl disable aien-owndriver-window.service >/dev/null 2>&1 || true |
| 18 | sudo -n rm -f "$UNIT" |
| 19 | sudo -n systemctl daemon-reload |
| 20 | log "no pending step: unit removed" |
| 21 | ;; |
| 22 | esac |