#!/usr/bin/env bash

readonly SCRIPT_NAME="limine-scan"
export HOOK_CALLER="$SCRIPT_NAME"

cleanup() {
	if [[ -d /run/let ]] && mountpoint -q /run/let; then
		umount /run/let
	fi
}

if ! command -v limine-entry-tool &>/dev/null; then
	echo "ERROR: limine-entry-tool not found." >&2
	exit 1
fi

trap cleanup EXIT
exec limine-entry-tool --scan || exit $?
