patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob 445604f5c98a60448f5e0b53410e3d79a9800a59 1074 bytes (raw)
name: host/rootfs/etc/s6-linux-init/run-image/service/serial-getty-generator/run 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 
#!/bin/execlineb -P
# SPDX-License-Identifier: EUPL-1.2+
# SPDX-FileCopyrightText: 2024-2025 Alyssa Ross <hi@alyssa.is>

piperw 3 4
background {
  fdclose 3
  fdmove 2 4
  inotifywait -e MODIFY /sys/class/tty/console/active
}
fdclose 4
importas -i inotifywait_pid !

foreground {
  if { fdmove 0 3 grep -qx "Watches established." }
  background { fdmove 0 3 cat }
  fdclose 3

  # Wait until inotifywait is ready before updating serial gettys,
  # so that changes won't be missed in between updating and starting
  # inotifywait.
  pipeline { s6-instance-list /run/service/serial-getty }
  pipeline { sort }
  fdmove -c 3 0
  
  redirfd -r 0 /sys/class/tty/console/active
  pipeline { tr " " "\n" }
  pipeline { sort }
  
  pipeline { comm -3 - /proc/self/fd/3 }
  forstdin -Ep line
  case -N $line {
    "	?tty[0-9]*" { }
    "	(.*)" {
      importas -i tty 1
      s6-instance-delete /run/service/serial-getty $tty
    }
  }
  s6-instance-create /run/service/serial-getty $line
}

# Block until the active consoles change, then let s6 restart us.
wait -- $inotifywait_pid

debug log:

solving 445604f ...
found 445604f in https://inbox.spectrum-os.org/spectrum-devel/20250613140508.76998-2-hi@alyssa.is/

applying [1/1] https://inbox.spectrum-os.org/spectrum-devel/20250613140508.76998-2-hi@alyssa.is/
diff --git a/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty-generator/run b/host/rootfs/etc/s6-linux-init/run-image/service/serial-getty-generator/run
new file mode 100755
index 0000000..445604f

1:31: trailing whitespace.
  
1:35: trailing whitespace.
  
Checking patch host/rootfs/etc/s6-linux-init/run-image/service/serial-getty-generator/run...
Applied patch host/rootfs/etc/s6-linux-init/run-image/service/serial-getty-generator/run cleanly.
warning: 2 lines add whitespace errors.

index at:
100755 445604f5c98a60448f5e0b53410e3d79a9800a59	host/rootfs/etc/s6-linux-init/run-image/service/serial-getty-generator/run

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).