#!/bin/bash # Read-only boot acceptance inside the marked disposable QEMU installation. set -euo pipefail choice=${1:?choose generic/balanced/tuned} [[ -f /var/lib/phoebus/postinstall-test-vm ]] case "$(cat /sys/class/dmi/id/sys_vendor)" in QEMU|KVM) ;; *) exit 2 ;; esac trap 'echo "CASE postinstall-kernel-boot-$choice FAIL"' ERR release=$(uname -r) case "$choice:$release" in generic:*-gentoo-dist-bin|balanced:*-gentoo-dist-phoebus-balanced|tuned:*-gentoo-dist-phoebus-tuned) ;; *) echo "unexpected kernel release: $release" >&2; exit 1 ;; esac printf 'KERNEL_RELEASE=%s\n' "$release" [[ $(systemctl is-system-running) == running ]] [[ $(systemctl --failed --no-legend --no-pager | wc -l) == 0 ]] [[ -n $(portageq match / sys-kernel/gentoo-kernel-bin) ]] [[ -d /usr/lib/modules/$release/kernel ]] if [[ $choice != generic ]]; then config="/usr/lib/modules/$release/build/.config" grep -Fxq "CONFIG_LOCALVERSION=\"-gentoo-dist-phoebus-$choice\"" "$config" for symbol in USB_USBNET USB_RTL8152 USB_UAS USB_STORAGE USB_SERIAL_FTDI_SIO EXFAT_FS; do grep -Fxq "CONFIG_$symbol=m" "$config" done for module in uas r8152 cdc_ether usb_storage ftdi_sio exfat; do file=$(modinfo -k "$release" -F filename "$module") [[ -f $file ]] done if [[ $choice == tuned ]]; then grep -Fxq 'CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y' "$config" fi echo "CASE postinstall-kernel-config-$choice PASS" fi # This must be the installed root, rather than the recovery snapshot. grep -q 'rootflags=subvol=@ ' /proc/cmdline sys history --legacy >/dev/null [[ $(pgrep -xc greetd) -gt 0 ]] echo "CASE postinstall-kernel-boot-$choice PASS"