#!/bin/sh
cat <<'EOF'

# add menu entry for efi shell if present as $ESP/shell${efiarch}.efi
# following the naming convention used by systemd-boot
if [ "$grub_platform" = "efi" -a "$lockdown" != "y" ]; then
	if [ "$grub_cpu" = "aarch64" ]; then
		set shell_name="shellaa64.efi"
	fi
	if [ "$grub_cpu" = "x86_64" ]; then
		set shell_name="shellx64.efi"
	fi
	if [ "$shell_name" != ""]; then
		search --file --set=shell_part /$shell_name
		if [ "$shell_part" != "" ]; then
			menuentry 'UEFI Shell' {
				chainloader ($shell_part)/$shell_name
			}
		fi
	fi
fi
EOF
