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
| | #!/bin/execlineb -P
# SPDX-License-Identifier: EUPL-1.2+
# SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
if -n {
# If this is a Spectrum installer eosimages partition, we might be
# booting from the installer, and should loopback mount the images.
importas -i mdev MDEV
if {
backtick -E type { lsblk -lnpo PARTTYPE $mdev }
test $type = 56a3bbc3-aefa-43d9-a64d-7b3fd59bbc4e
}
if {
forx -pE module { ext4 loop }
modprobe $module
}
backtick -E uuid { lsblk -lnpo PARTUUID $mdev }
if { mkdir -p /mnt/${uuid} }
if { mount $mdev /mnt/${uuid} }
find /mnt/${uuid} -name *.img -exec
losetup -Pf {}
;
}
# Check whether we now have all the partitions we need to boot.
importas -i rootfs_uuid ROOTFS_UUID
importas -i verity_uuid VERITY_UUID
backtick -E rootfs_dev { findfs PARTUUID=${rootfs_uuid} }
backtick -E verity_dev { findfs PARTUUID=${verity_uuid} }
if { ln -s $rootfs_dev /dev/rootfs }
if { ln -s $verity_dev /dev/verity }
redirfd -w -nb 1 /dev/rootfs.poll echo
|