[partition] Consider the future flags when checking EFI bootability

- If we're changing the flags to enable EFI boot, then that's
   enough to satisfy the (future) EFI bootability check.
   This is for issue #622 as well. Fixes #884.
This commit is contained in:
Adriaan de Groot 2018-05-16 07:28:30 -04:00
parent 0df304b206
commit 336b8c758a

View File

@ -22,6 +22,7 @@
#include "core/DeviceModel.h" #include "core/DeviceModel.h"
#include "core/KPMHelpers.h" #include "core/KPMHelpers.h"
#include "core/PartitionInfo.h"
#include "core/PartitionIterator.h" #include "core/PartitionIterator.h"
#include <kpmcore/backend/corebackend.h> #include <kpmcore/backend/corebackend.h>
@ -343,8 +344,10 @@ isEfiSystem()
bool bool
isEfiBootable( const Partition* candidate ) isEfiBootable( const Partition* candidate )
{ {
auto flags = PartitionInfo::flags( candidate );
/* If bit 17 is set, old-style Esp flag, it's OK */ /* If bit 17 is set, old-style Esp flag, it's OK */
if ( candidate->activeFlags().testFlag( PartitionTable::FlagEsp ) ) if ( flags.testFlag( PartitionTable::FlagEsp ) )
return true; return true;
@ -359,7 +362,7 @@ isEfiBootable( const Partition* candidate )
const PartitionTable* table = dynamic_cast<const PartitionTable*>( root ); const PartitionTable* table = dynamic_cast<const PartitionTable*>( root );
return table && ( table->type() == PartitionTable::TableType::gpt ) && return table && ( table->type() == PartitionTable::TableType::gpt ) &&
candidate->activeFlags().testFlag( PartitionTable::FlagBoot ); flags.testFlag( PartitionTable::FlagBoot );
} }
} // nmamespace PartUtils } // nmamespace PartUtils