function BOOT_NOT_MOUNTED {
	mount /boot
}

function CONFIGURATION_MISSING {
	mount -o remount,rw /boot &&
	update-grub &&
	mount -o remount,ro /boot
}

function MODULE_VERSION_MISMATCH {
	local MODULE_NAME=$1

	BOOT_DEVICE_PATH=$(awk '{if ($2=="/boot" && ( $3=="ext2" || $3=="vfat" ) ){print $1}}' /proc/mounts)
	if [[ ! -b $BOOT_DEVICE_PATH ]]; then
		return 1
	fi
	BOOT_DEVICE=${BOOT_DEVICE_PATH#/dev/}

	GRUB_DEVICE=$(basename "$(readlink -f "/sys/class/block/$BOOT_DEVICE/..")")
	GRUB_DEVICE_PATH="/dev/$GRUB_DEVICE"
	if [[ ! -b $GRUB_DEVICE_PATH ]]; then
		return 1
	fi

	mount -o remount,rw /boot &&
	grub-install $GRUB_DEVICE_PATH &&
	mount -o remount,ro /boot
}
