The root mount-point can end with a / while the mount-point read from
the file /etc/mtab does not end with a /.
This leads to skip the unmounting of the root mount-point and causes the
removal of the root mountpoint directory to fail with EBUSY because it
is still mounted.
This uses the python functions os.path.normpath() to normalize the root
mount-point (i.e. to drop the trailing /) and os.path.commonprefix() to
determine the longest common prefix between the two mount-points. If the
returned prefix is identical to the normalized root mount-point then the
mount-point must be added to the list of the mount-points to unmount.
More generally, the python modules should rely on the os.path functions
to compare for paths instead of using strings. It covers this way lots
of corner cases (path with "//", "/../", "/./", ...).
- put the writing of each kind of file in its own block -- this should
become separate functions -- so that variables become more local
and debugging can be improved.
- while here, fix the error message for /etc/default/keyboard:
it would complain and name the vconsole file path if it ever failed.
- factor out the flags-we-want from the flags-we-already-have
- the use of ->activeFlags() meant that the state on *disk* was
being compared with the flags-we-want; if a partition was re-edited,
then you couldn't change the flags back to the state-on-disk
(eg. enable a flag, then change your mind and disable it).
- set the flags before refreshing the partition, because the
refresh checks for EFI bootability and that needs the new flags,
not the old ones.
- remove the m_defaultFSType from PartitionLayout, because it is
set on construction -- which is too early, before the configuration
has been read.
- make the default FS explicit in the init() calls which pass in
a configuration; this needs support in the intermediate
PartitionCoreModule.
- the "simple" constructor for PartitionEntry left the FS type
set as the constructor left it -- which is Unknown by default.
This leads to install failures in systems that don't set a
special layout but just want a single / -- because the FS is
set to Unknown.
- massage the constructor and consumer of the code, push
Ext4 FS in the tests and use the configured default in production.
The return of the call to libcalamares.utils.mount is never tested and
it may fail silently; this causes some mounpoints to be missing.
This adds a warning if mountpoint cannot be mounted.
chcon: failed to get security context of '/tmp/verity': Operation not supported
06:44:23 [6]: static CalamaresUtils::ProcessResult CalamaresUtils::System::runCommand(CalamaresUtils::System::RunLocation, const QStringList&, const QString&, const QString&, std::chrono::seconds)
Running "env" ("mount", "-t", "unformatted", "/dev/sdb2", "/tmp/calamares-root-kv8dqgb5/tmp/verity")
.. Finished. Exit code: 32
.. Target cmd: ("mount", "-t", "unformatted", "/dev/sdb7", "/tmp/calamares-root-kv8dqgb5/tmp/verity") output:
mount: /tmp/calamares-root-kv8dqgb5/tmp/verity: unknown filesystem type 'unformatted'.