#!/bin/bash
# checks for successful boot
source $(dirname $BASH_SOURCE)/vtcommon

need_root

get_kver

if [ ! -f "/boot/hash-${kver}" ];then
    echo "no hash to check against"
    exit 0
fi

echo "file:$(cat /boot/hash-${kver})"
echo "kernel:$(get_kparam KERNEL_HASH)"

if [ "$(cat /boot/hash-${kver})" == "$(get_kparam KERNEL_HASH)" ];then
    echo "hash match !"
    rm /boot/hash-${kver}
    vtflash $(uname -r) yes
    exit
fi

echo "hash mismatch"
