#!/usr/bin/env bash # SPDX-License-Identifier: LGPL-2.1-or-later # shellcheck disable=SC2235 set -eu set -o pipefail kernel_install="${1:?}" plugin="${2:?}" D="$(mktemp --tmpdir --directory "test-kernel-install.XXXXXXXXXX")" # shellcheck disable=SC2064 trap "rm -rf '$D'" EXIT INT QUIT PIPE mkdir -p "$D/boot" mkdir -p "$D/efi" mkdir -p "$D/sources" echo 'buzy image' >"$D/sources/linux" echo 'the initrd' >"$D/sources/initrd" echo 'the-token' >"$D/sources/entry-token" echo 'opt1 opt2' >"$D/sources/cmdline" cat >"$D/sources/install.conf" <"$D/sources/tries" "$kernel_install" -v add 1.1.1 "$D/sources/linux" "$D/sources/initrd" entry="$BOOT_ROOT/loader/entries/the-token-1.1.1+56.conf" test -f "$entry" grep -qE '^title ' "$entry" grep -qE '^version +1.1.1' "$entry" grep -qE '^options +opt1 opt2' "$entry" grep -qE '^linux .*/the-token/1.1.1/linux' "$entry" grep -qE '^initrd .*/the-token/1.1.1/initrd' "$entry" grep -qE 'image' "$BOOT_ROOT/the-token/1.1.1/linux" grep -qE 'initrd' "$BOOT_ROOT/the-token/1.1.1/initrd"