Compare commits
12 Commits
v2.3-beta1
...
v2.3-beta2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7c89bc87ce | ||
![]() |
66a516038b | ||
![]() |
0f8ef4220c | ||
![]() |
e6806048e4 | ||
![]() |
73e4cee81b | ||
![]() |
5a6bc95859 | ||
![]() |
4271cfda1f | ||
![]() |
ce8ffb8e52 | ||
![]() |
49cb6d304d | ||
![]() |
e7c5a2b1a5 | ||
![]() |
fba8e448bb | ||
![]() |
bea6b5f17e |
@@ -102,7 +102,7 @@ set( CALAMARES_TRANSLATION_LANGUAGES ar ast bg ca cs_CZ da de el en en_GB es_MX
|
||||
### Bump version here
|
||||
set( CALAMARES_VERSION_MAJOR 2 )
|
||||
set( CALAMARES_VERSION_MINOR 2 )
|
||||
set( CALAMARES_VERSION_PATCH 93 )
|
||||
set( CALAMARES_VERSION_PATCH 94 )
|
||||
set( CALAMARES_VERSION_RC 0 )
|
||||
|
||||
set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} )
|
||||
|
@@ -27,7 +27,7 @@ Modules:
|
||||
* partition:
|
||||
* extra-cmake-modules
|
||||
* KF5: KCoreAddons, KConfig, KI18n, KIconThemes, KIO, KService
|
||||
* KPMcore >= 2.1
|
||||
* KPMcore >= 2.2
|
||||
* sgdisk
|
||||
* bootloader:
|
||||
* systemd-boot or GRUB
|
||||
|
@@ -4,6 +4,7 @@
|
||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
#
|
||||
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
# Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
||||
#
|
||||
# Calamares is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -24,7 +25,7 @@ import re
|
||||
import libcalamares
|
||||
|
||||
|
||||
HEADER = """# /etc/fstab: static file system information.
|
||||
FSTAB_HEADER = """# /etc/fstab: static file system information.
|
||||
#
|
||||
# Use 'blkid' to print the universally unique identifier for a device; this may
|
||||
# be used with UUID= as a more robust way to name devices that works even if
|
||||
@@ -32,6 +33,20 @@ HEADER = """# /etc/fstab: static file system information.
|
||||
#
|
||||
# <file system> <mount point> <type> <options> <dump> <pass>"""
|
||||
|
||||
CRYPTTAB_HEADER = """# /etc/crypttab: mappings for encrypted partitions.
|
||||
#
|
||||
# Each mapped device will be created in /dev/mapper, so your /etc/fstab
|
||||
# should use the /dev/mapper/<name> paths for encrypted devices.
|
||||
#
|
||||
# See crypttab(5) for the supported syntax.
|
||||
#
|
||||
# NOTE: Do not list your root (/) partition here, it must be set up
|
||||
# beforehand by the initramfs (/etc/mkinitcpio.conf). The same applies
|
||||
# to encrypted swap, which should be set up with mkinitcpio-openswap
|
||||
# for resume support.
|
||||
#
|
||||
# <name> <device> <password> <options>"""
|
||||
|
||||
# Turn Parted filesystem names into fstab names
|
||||
FS_MAP = {
|
||||
"fat16": "vfat",
|
||||
@@ -61,8 +76,8 @@ def is_ssd_disk(disk_name):
|
||||
# Should not happen unless sysfs changes, but better safe than sorry
|
||||
return False
|
||||
|
||||
with open(filename) as f:
|
||||
return f.read() == "0\n"
|
||||
with open(filename) as sysfile:
|
||||
return sysfile.read() == "0\n"
|
||||
|
||||
|
||||
def disk_name_for_partition(partition):
|
||||
@@ -73,7 +88,7 @@ def disk_name_for_partition(partition):
|
||||
"""
|
||||
name = os.path.basename(partition["device"])
|
||||
|
||||
if name.startswith("/dev/mmcblk"):
|
||||
if name.startswith("/dev/mmcblk") or name.startswith("/dev/nvme"):
|
||||
return re.sub("p[0-9]+$", "", name)
|
||||
|
||||
return re.sub("[0-9]+$", "", name)
|
||||
@@ -102,6 +117,7 @@ class FstabGenerator(object):
|
||||
"""
|
||||
self.find_ssd_disks()
|
||||
self.generate_fstab()
|
||||
self.generate_crypttab()
|
||||
self.create_mount_points()
|
||||
|
||||
return None
|
||||
@@ -111,19 +127,62 @@ class FstabGenerator(object):
|
||||
disks = {disk_name_for_partition(x) for x in self.partitions}
|
||||
self.ssd_disks = {x for x in disks if is_ssd_disk(x)}
|
||||
|
||||
def generate_crypttab(self):
|
||||
""" Create crypttab. """
|
||||
mkdir_p(os.path.join(self.root_mount_point, "etc"))
|
||||
crypttab_path = os.path.join(self.root_mount_point, "etc", "crypttab")
|
||||
|
||||
with open(crypttab_path, "w") as crypttab_file:
|
||||
print(CRYPTTAB_HEADER, file=crypttab_file)
|
||||
|
||||
for partition in self.partitions:
|
||||
dct = self.generate_crypttab_line_info(partition)
|
||||
|
||||
if dct:
|
||||
self.print_crypttab_line(dct, file=crypttab_file)
|
||||
|
||||
def generate_crypttab_line_info(self, partition):
|
||||
""" Generates information for each crypttab entry. """
|
||||
if "luksMapperName" not in partition or "luksUuid" not in partition:
|
||||
return None
|
||||
|
||||
mapper_name = partition["luksMapperName"]
|
||||
mount_point = partition["mountPoint"]
|
||||
luks_uuid = partition["luksUuid"]
|
||||
if not mapper_name or not luks_uuid:
|
||||
return None
|
||||
|
||||
if mount_point == "/":
|
||||
return None
|
||||
|
||||
return dict(
|
||||
name=mapper_name,
|
||||
device="UUID=" + luks_uuid,
|
||||
password="/crypto_keyfile.bin",
|
||||
)
|
||||
|
||||
def print_crypttab_line(self, dct, file=None):
|
||||
""" Prints line to '/etc/crypttab' file. """
|
||||
line = "{:21} {:<45} {}".format(dct["name"],
|
||||
dct["device"],
|
||||
dct["password"],
|
||||
)
|
||||
|
||||
print(line, file=file)
|
||||
|
||||
def generate_fstab(self):
|
||||
""" Create fstab. """
|
||||
mkdir_p(os.path.join(self.root_mount_point, "etc"))
|
||||
fstab_path = os.path.join(self.root_mount_point, "etc", "fstab")
|
||||
|
||||
with open(fstab_path, "w") as fl:
|
||||
print(HEADER, file=fl)
|
||||
with open(fstab_path, "w") as fstab_file:
|
||||
print(FSTAB_HEADER, file=fstab_file)
|
||||
|
||||
for partition in self.partitions:
|
||||
dct = self.generate_fstab_line_info(partition)
|
||||
|
||||
if dct:
|
||||
self.print_fstab_line(dct, file=fl)
|
||||
self.print_fstab_line(dct, file=fstab_file)
|
||||
|
||||
if self.root_is_ssd:
|
||||
# Mount /tmp on a tmpfs
|
||||
@@ -132,27 +191,24 @@ class FstabGenerator(object):
|
||||
fs="tmpfs",
|
||||
options="defaults,noatime,mode=1777",
|
||||
check=0,
|
||||
)
|
||||
self.print_fstab_line(dct, file=fl)
|
||||
)
|
||||
self.print_fstab_line(dct, file=fstab_file)
|
||||
|
||||
def generate_fstab_line_info(self, partition):
|
||||
""" Generates information for each fstab entry.
|
||||
|
||||
:param partition:
|
||||
:return:
|
||||
"""
|
||||
fs = partition["fs"]
|
||||
""" Generates information for each fstab entry. """
|
||||
filesystem = partition["fs"]
|
||||
mount_point = partition["mountPoint"]
|
||||
disk_name = disk_name_for_partition(partition)
|
||||
is_ssd = disk_name in self.ssd_disks
|
||||
fs = FS_MAP.get(fs, fs)
|
||||
filesystem = FS_MAP.get(filesystem, filesystem)
|
||||
|
||||
if not mount_point and not fs == "swap":
|
||||
if not mount_point and not filesystem == "swap":
|
||||
return None
|
||||
|
||||
options = self.mount_options.get(fs, self.mount_options["default"])
|
||||
options = self.mount_options.get(filesystem,
|
||||
self.mount_options["default"])
|
||||
if is_ssd:
|
||||
extra = self.ssd_extra_mount_options.get(fs)
|
||||
extra = self.ssd_extra_mount_options.get(filesystem)
|
||||
|
||||
if extra:
|
||||
options += "," + extra
|
||||
@@ -169,23 +225,19 @@ class FstabGenerator(object):
|
||||
|
||||
return dict(device="UUID=" + partition["uuid"],
|
||||
mount_point=mount_point or "swap",
|
||||
fs=fs,
|
||||
fs=filesystem,
|
||||
options=options,
|
||||
check=check,
|
||||
)
|
||||
)
|
||||
|
||||
def print_fstab_line(self, dct, file=None):
|
||||
""" Prints line to '/etc/fstab' file.
|
||||
|
||||
:param dct:
|
||||
:param file:
|
||||
"""
|
||||
""" Prints line to '/etc/fstab' file. """
|
||||
line = "{:41} {:<14} {:<7} {:<10} 0 {}".format(dct["device"],
|
||||
dct["mount_point"],
|
||||
dct["fs"],
|
||||
dct["options"],
|
||||
dct["check"],
|
||||
)
|
||||
)
|
||||
print(line, file=file)
|
||||
|
||||
def create_mount_points(self):
|
||||
@@ -200,12 +252,15 @@ def run():
|
||||
|
||||
:return:
|
||||
"""
|
||||
gs = libcalamares.globalstorage
|
||||
global_storage = libcalamares.globalstorage
|
||||
conf = libcalamares.job.configuration
|
||||
partitions = gs.value("partitions")
|
||||
root_mount_point = gs.value("rootMountPoint")
|
||||
partitions = global_storage.value("partitions")
|
||||
root_mount_point = global_storage.value("rootMountPoint")
|
||||
mount_options = conf["mountOptions"]
|
||||
ssd_extra_mount_options = conf.get("ssdExtraMountOptions", {})
|
||||
generator = FstabGenerator(partitions, root_mount_point, mount_options, ssd_extra_mount_options)
|
||||
generator = FstabGenerator(partitions,
|
||||
root_mount_point,
|
||||
mount_options,
|
||||
ssd_extra_mount_options)
|
||||
|
||||
return generator.run()
|
||||
|
@@ -59,13 +59,16 @@ KeyboardLayoutModel::data( const QModelIndex& index, int role ) const
|
||||
void
|
||||
KeyboardLayoutModel::init()
|
||||
{
|
||||
auto layouts = KeyboardGlobal::getKeyboardLayouts();
|
||||
for ( auto it = layouts.constBegin(); it != layouts.constEnd(); ++it )
|
||||
QMap< QString, KeyboardGlobal::KeyboardInfo > layouts =
|
||||
KeyboardGlobal::getKeyboardLayouts();
|
||||
for ( QMap< QString, KeyboardGlobal::KeyboardInfo >::const_iterator it = layouts.constBegin();
|
||||
it != layouts.constEnd(); ++it )
|
||||
{
|
||||
m_layouts.append( qMakePair( it.key(), it.value() ) );
|
||||
}
|
||||
|
||||
std::stable_sort( m_layouts.begin(), m_layouts.end(), []( auto a, auto b )
|
||||
std::stable_sort( m_layouts.begin(), m_layouts.end(), []( const QPair< QString, KeyboardGlobal::KeyboardInfo >& a,
|
||||
const QPair< QString, KeyboardGlobal::KeyboardInfo >& b )
|
||||
{
|
||||
return a.second.description < b.second.description;
|
||||
} );
|
||||
|
@@ -10,7 +10,7 @@ find_package( KF5 REQUIRED CoreAddons )
|
||||
# These are needed because KPMcore links publicly against ConfigCore, I18n, IconThemes, KIOCore and Service
|
||||
find_package( KF5 REQUIRED Config I18n IconThemes KIO Service )
|
||||
|
||||
find_package( KPMcore 2.1 REQUIRED )
|
||||
find_package( KPMcore 2.2 REQUIRED )
|
||||
|
||||
add_subdirectory( tests )
|
||||
|
||||
|
@@ -161,7 +161,7 @@ PartitionLabelsView::getIndexesToDraw( const QModelIndex& parent ) const
|
||||
//HACK: horrible special casing follows.
|
||||
// To save vertical space, we choose to hide short instances of free space.
|
||||
// Arbitrary limit: 10MB.
|
||||
const qint64 maxHiddenB = 10'000'000;
|
||||
const qint64 maxHiddenB = 10000000;
|
||||
if ( index.data( PartitionModel::IsFreeSpaceRole ).toBool() &&
|
||||
index.data( PartitionModel::SizeRole ).toLongLong() < maxHiddenB )
|
||||
continue;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
* Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,11 +19,15 @@
|
||||
|
||||
#include "jobs/CheckFileSystemJob.h"
|
||||
|
||||
#include <utils/Logger.h>
|
||||
|
||||
// KPMcore
|
||||
#include <kpmcore/core/partition.h>
|
||||
#include <kpmcore/fs/filesystem.h>
|
||||
#include <kpmcore/util/report.h>
|
||||
|
||||
#include <QThread>
|
||||
|
||||
CheckFileSystemJob::CheckFileSystemJob( Partition* partition )
|
||||
: PartitionJob( partition )
|
||||
{}
|
||||
@@ -53,6 +58,20 @@ CheckFileSystemJob::exec()
|
||||
|
||||
Report report( nullptr );
|
||||
bool ok = fs.check( report, partition()->partitionPath() );
|
||||
int retries = 0;
|
||||
const int MAX_RETRIES = 10;
|
||||
while ( !ok )
|
||||
{
|
||||
cDebug() << "Partition" << partition()->partitionPath()
|
||||
<< "might not be ready yet, retrying (" << ++retries
|
||||
<< "/" << MAX_RETRIES << ") ...";
|
||||
QThread::sleep( 2 /*seconds*/ );
|
||||
ok = fs.check( report, partition()->partitionPath() );
|
||||
|
||||
if ( retries == MAX_RETRIES )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !ok )
|
||||
return Calamares::JobResult::error(
|
||||
tr( "The file system check on partition %1 failed." )
|
||||
|
Reference in New Issue
Block a user