#!/bin/execlineb -S0 # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross # SPDX-License-Identifier: EUPL-1.2+ export PATH /bin if { mount -a } if { mkfifo /dev/rootfs.poll } background { mdevd -C -b134217728 } multisubstitute { importas -iu mdevd_pid ! importas -i roothash x-spectrum-roothash } if { modprobe erofs } # Do a blocking read on the fifo to wait for mdevd to find the # partition. if { redirfd -r 0 /dev/rootfs.poll redirfd -w 1 /dev/null head -c 1 } background { kill $mdevd_pid } background { rm /dev/rootfs.poll } if { veritysetup open /dev/rootfs root-verity /dev/verity $roothash } background { rm /dev/rootfs /dev/verity } if { mount /dev/mapper/root-verity /mnt/root } wait { $mdevd_pid } if { mount --move /proc /mnt/root/proc } if { mount --move /sys /mnt/root/sys } if { mount --move /dev /mnt/root/dev } switch_root /mnt/root /etc/init