#!/bin/execlineb -P # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2021 Alyssa Ross 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 uuid { lsblk -lnpo PARTUUID $mdev } multisubstiute { define mdev_ $mdev importas -Si uuid } 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 version x-spectrum-version backtick rootfs_dev { findfs PARTLABEL=Spectrum_OS_${version} } backtick verity_dev { findfs PARTLABEL=Spectrum_OS_${version}.verity } multisubstitute { importas -iS rootfs_dev importas -iS verity_dev } if { ln -s $rootfs_dev /dev/rootfs } if { ln -s $verity_dev /dev/verity } redirfd -w -nb 1 /dev/rootfs.poll echo