[partition] use configured default filesystem type instead of ext4

When using the default partition layout (only a `/` partition), the
filesystem used was ext4, ignoring the `defaultFileSystemType`
configuration option.

This commit fixes this bug, so that any supported filesystem can now be
used for the default partitioning scheme.

Fixes #1093

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
main
Arnaud Ferraris 6 years ago
parent 3ea6c6cfbe
commit 586cb63ef5

@ -18,6 +18,9 @@
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "GlobalStorage.h"
#include "JobQueue.h"
#include "core/PartitionLayout.h"
#include "core/KPMHelpers.h"
@ -28,17 +31,32 @@
#include <kpmcore/core/partition.h>
#include <kpmcore/fs/filesystem.h>
static int
getDefaultFileSystemType()
{
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
int defaultFs = FileSystem::typeForName( gs->value( "defaultFileSystemType" ).toString() );
if ( defaultFs == FileSystem::Unknown )
defaultFs = FileSystem::Ext4;
return defaultFs;
}
PartitionLayout::PartitionLayout()
{
defaultFsType = getDefaultFileSystemType();
}
PartitionLayout::PartitionLayout( PartitionLayout::PartitionEntry entry )
{
defaultFsType = getDefaultFileSystemType();
partLayout.append( entry );
}
PartitionLayout::PartitionLayout( const PartitionLayout& layout )
: partLayout( layout.partLayout )
, defaultFsType( layout.defaultFsType )
{
}
@ -115,7 +133,7 @@ PartitionLayout::addEntry( const QString& mountPoint, const QString& size, const
PartitionLayout::PartitionEntry entry( size, min );
entry.partMountPoint = mountPoint;
entry.partFileSystem = FileSystem::Ext4;
entry.partFileSystem = defaultFsType;
partLayout.append( entry );
}
@ -128,6 +146,8 @@ PartitionLayout::addEntry( const QString& label, const QString& mountPoint, cons
entry.partLabel = label;
entry.partMountPoint = mountPoint;
entry.partFileSystem = FileSystem::typeForName( fs );
if ( entry.partFileSystem == FileSystem::Unknown )
entry.partFileSystem = defaultFsType;
partLayout.append( entry );
}

@ -76,6 +76,7 @@ public:
QList< Partition* > execute( Device *dev, qint64 firstSector, qint64 lastSector, QString luksPassphrase, PartitionNode* parent, const PartitionRole& role );
private:
int defaultFsType;
QList< PartitionEntry > partLayout;
};

Loading…
Cancel
Save