| 1 |
# Runs the Alloy installer on VT1 when booted from the installer ISO. |
| 2 |
# |
| 3 |
# Gated on a kernel command line flag rather than shipped disabled and |
| 4 |
# enabled by the ISO build: the same image is both the live installer and |
| 5 |
# the system it installs, and an installer that could start on an installed |
| 6 |
# machine is a way to lose a disk. `alloy.installer` is set only by the |
| 7 |
# GRUB entries in build/build-iso.sh, so this unit is inert everywhere else. |
| 8 |
# |
| 9 |
# Three things want VT1: this, greetd, and getty@tty1. The kernel flag above |
| 10 |
# settles it, and each of the three answers for itself. |
| 11 |
# |
| 12 |
# greetd stays away by its own condition, the negation of this one, in |
| 13 |
# etc/systemd/system/greetd.service.d/10-installer-medium.conf. That file |
| 14 |
# carries the history of the two arrangements that did not work, both of |
| 15 |
# which were versions of this unit reaching across to stop the greeter. |
| 16 |
# |
| 17 |
# getty@tty1 is stopped here, from ExecStartPre rather than `Conflicts=`. |
| 18 |
# `Conflicts=` is applied when the start job is ENQUEUED, before the |
| 19 |
# condition above is checked, so on an installed machine it would displace |
| 20 |
# getty even though the installer never runs. ExecStartPre runs only after |
| 21 |
# the condition has passed. Unlike greetd, getty@tty1 is not pulled by a |
| 22 |
# target that would restart it, so stopping it once is enough. The leading |
| 23 |
# `-` keeps stopping a unit that is not running from failing the install |
| 24 |
# before it starts. |
| 25 |
[Unit] |
| 26 |
Description=Alloy installer |
| 27 |
Documentation=https://git.sr.ht/~maxmj/alloy |
| 28 |
ConditionKernelCommandLine=alloy.installer |
| 29 |
After=systemd-user-sessions.service systemd-logind.service |
| 30 |
Before=getty.target |
| 31 |
|
| 32 |
[Service] |
| 33 |
ExecStartPre=-/usr/bin/systemctl stop getty@tty1.service |
| 34 |
# Type=idle so the boot's own console output has finished before a |
| 35 |
# full-screen TUI takes the terminal; without it the first frame draws |
| 36 |
# over service status lines and the user sees a torn screen. |
| 37 |
Type=idle |
| 38 |
ExecStart=/usr/bin/alloy install |
| 39 |
TTYPath=/dev/tty1 |
| 40 |
StandardInput=tty |
| 41 |
StandardOutput=tty |
| 42 |
StandardError=journal |
| 43 |
TTYReset=yes |
| 44 |
TTYVHangup=yes |
| 45 |
TTYVTDisallocate=yes |
| 46 |
|
| 47 |
# A crashed installer must not leave a blank VT with no way forward. It is |
| 48 |
# also not something to retry forever: the disk may be half written, so |
| 49 |
# coming back to a fresh wizard would invite a second pass over it. |
| 50 |
Restart=no |
| 51 |
|
| 52 |
[Install] |
| 53 |
WantedBy=multi-user.target |
| 54 |
|