#!/usr/bin/env bash

if [[ $EUID -ne 0 ]]; then
	echo -e "\033[91m limine-enroll-config must be run with root privileges.\033[0m" >&2
	exit 1
fi

# Import functions and environment variables
LIMINE_FUNCTIONS_PATH=/usr/lib/limine/limine-common-functions

if [[ -f "${LIMINE_FUNCTIONS_PATH}" ]]; then
	# shellcheck disable=SC1090
	source "${LIMINE_FUNCTIONS_PATH}" || {
		echo -e "\033[1;31m Error: Failed to source '${LIMINE_FUNCTIONS_PATH}'.\033[0m" >&2
		exit 1
	}
	initialize_header || exit 1
	enroll_config
fi
