+format_efi_partition() {
+ if [ -z "$EFI" ] ; then
+ return 0
+ fi
+
+ if ! [ -b "$EFI" ] ; then
+ eerror "Specified efi argument [$EFI] not a valid block device."
+ bailout 1
+ fi
+
+ if fsck.vfat -bn "$EFI" >/dev/null; then
+ einfo "EFI partition $EFI seems to have a FAT filesystem, not modifying." ; eend 0
+ else
+ einfo "EFI partition $EFI doesn't seem to be formated, creating filesystem."
+ mkfs.fat -F32 -n "EFI System Partition" "$EFI"
+ RC=$?
+ if [ $RC -eq 0 ] ; then
+ eend 0
+ else
+ eerror "Error while creating filesystem on ${EFI}."
+ eend 1
+ bailout 1
+ fi
+ fi
+}
+
+# check for EFI support or try to enable it {{{
+efi_support() {
+ if lsmod | grep -q efivars ; then
+ einfo "EFI support detected." ; eend 0
+ return 0
+ fi
+
+ if modprobe efivars &>/dev/null ; then
+ einfo "EFI support enabled now." ; eend 0
+ return 0
+ fi
+
+ return 1
+}
+# }}}
+