#!/bin/sh
# Detects Veracrypt bootloader on a EFI System Partition

. /usr/share/os-prober/common.sh

efi="$1"

found=
for veracrypt in $(item_in_dir veracrypt "$efi"); do
	dcsboot=$(item_in_dir dcsboot.efi "$efi/$veracrypt")
	if [ -n "$veracrypt" -a -n "$dcsboot" ]; then
		long="Veracrypt encrypted OS"
		short=Veracrypt
		path="$veracrypt/$dcsboot"
		found=true
		break
	fi
done


if [ -n "$found" ]; then
	label="$(count_next_label "$short")"
	result "${path}:${long}:${label}"
fi
exit 0
