#!/bin/bash

if [ -n "$(find /boot/efi/boot/grub* -name normal.mod 2> /dev/null)" ]; then
	MEASURECONF_PATH=$(ls -d /boot/efi/boot/grub*)
fi

if [ -n "$(find /boot/grub* -name normal.mod 2> /dev/null)" ]; then
	MEASURECONF_PATH=$(ls -d /boot/grub*)
fi

if [ -z "$MEASURECONF_PATH" ];then
	echo "ERROR: not find grub mod files"
	exit 0
fi

FILE=".measureconf"
MEASURECONF="$MEASURECONF_PATH/$FILE"


create_conf()
{
	if [ -z "$MEASURECONF" -o ! -f "$MEASURECONF" ];then
		echo "trust_measure_type:no" >> $MEASURECONF
		echo "trust_measure_mode:waring" >> $MEASURECONF
	fi
}

create_conf
