max / alloy
| 1 | #!/bin/sh |
| 2 | # alloy-layer-notice — tell the person at the machine what the blank boot is. |
| 3 | # |
| 4 | # alloy-layer-components.service lays the console and terminal down as layered |
| 5 | # packages, then reboots. Two boots therefore show nothing a user can act on: |
| 6 | # the first one after an install, and the first one after adopting a rebuilt |
| 7 | # image, because `bootc switch` discards the layer and the unit re-fires to |
| 8 | # install the new image's copy (measured, build/layertest/README.md). The |
| 9 | # second of those is the common case and the one nobody expects, since the |
| 10 | # machine was working when they typed the command. |
| 11 | # |
| 12 | # Installed machines boot with `quiet loglevel=3` so kernel and audit output |
| 13 | # does not overwrite tuigreet (usr/lib/bootc/kargs.d/10-alloy.toml), and there |
| 14 | # is no plymouth. So that boot is a genuinely blank screen: systemd's own |
| 15 | # status lines are suppressed by `quiet`, and the unit's Description never |
| 16 | # reaches anyone. Nothing tells the user, hence this. |
| 17 | # |
| 18 | # Writing to /dev/console rather than to stdout, and it is the point rather |
| 19 | # than a detail. The unit's output goes to the journal, which is exactly where |
| 20 | # a person with no console and no terminal cannot read it. `quiet` filters |
| 21 | # kernel printk and does not touch a userspace write to the console device, so |
| 22 | # this lands on the foreground VT whatever the cmdline says. |
| 23 | # |
| 24 | # `|| true` on every write, and no `set -e`. This script is on the boot path in |
| 25 | # front of the only thing that gives the machine a console: a notice that fails |
| 26 | # must never be the reason the components are not installed. Same argument as |
| 27 | # alloy-session's, one unit earlier. |
| 28 | # |
| 29 | # Deliberately dependency-free: sh, printf, one redirect. It runs on a machine |
| 30 | # that does not have its own console yet, so anything it reaches for is |
| 31 | # something that can be missing. |
| 32 | |
| 33 | |
| 34 | || |
| 35 | } |
| 36 | |
| 37 | case "" in |
| 38 | start) |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | ;; |
| 49 | fail) |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | ;; |
| 59 | *) |
| 60 | # An unknown argument is a caller bug, and the unit is the only caller. |
| 61 | # Saying nothing is right: the alternative is a machine whose first |
| 62 | # words to its owner are a usage message. |
| 63 | ;; |
| 64 | esac |
| 65 |