- There is no reason for JobThread to have a Q_OBJECT macro,
so drop the moccing (this also stops some warnings from
the generated moc code).
- Define the (virtual) destructor out-of-line to avoid vtable
warnings.
- The auto-generated code produces a lot of warnings from
Clang 8; this obscures the more meaningful warnings from
actual Calamares code, so tone the warnings down.
- For Clang, set CALAMARES_MOC_OPTIONS.
- Add convenience CMake function for automoccing. It applies
the options as needed to a given target.
- Use only utils/YamlUtils.h to pull in yaml-cpp and supporting code.
- When compiling with clang, turn off warnings that the system header
for yaml-cpp would generate.
- This is an older copy of kdsingleapplicationguard, now updated for
C++11 warnings; removed __ in header guards, fixed up last of 0-for-
nullptr, signedness mismatch.
This commit adds several checks while reading the configuration of the
`partition` module, in case the partition layout configuration is
misformed. If an error is encountered, an message is printed to the
console and the module reverts to the default partition layout.
Checks are also added when implementing the partition layout, in case a
problem occurs that couldn't be anticipated (for example, when a
partition size is in %, checking its absolute value require knowing the
total device size, which is not the case when the configuration is
being read).
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Every call of `ParseStringSize` is replaced by using an instance of the
`PartUtils::PartSize` class.
This commit also removes the now-unused previous size parsing functions.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
In order to maintain consistency, and make use, create a new PartSize
class in the PartUtils namespace, which inherits from NamedSuffix for
easier parsing and handling of size strings.
The switch to using this class instead of the previous functions will be
done in a follow-up commit.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Fixed 'prepend' terminology in comments, restored old loop as it seems to work for me now in overwriting the file as one overall multiline instead of overwriting the file with each line at a time, code simplification based on review comments... credits-adding will come in the next commit.
This change fixes a few issues and adds a few improvements to the LightDM Autologin configuration process:
Fixes:
- Fixes malforming of configuration file out of the box, as without `[SeatDefaults]`, `[Seat:*]` or similar in the configuration file LightDM will break on a lot of distributions using LightDM
- Preserves the intended lightdm.conf file settings outside of `autologin-user` if the distribution has an /etc/lightdm/lightdm.conf file of its own
Misc. changes:
- Small spelling fix
- Instead of Continuation(), write just Continuation
- All that futzing with overloads and tag-classes isn't needed
since the whole point is to output some constant string. Leave
cleverness for later, if it's needed.
- KDE neon ships a post-3.3.0 KPMCore, with deprecations, but not yet
the KPMCore 4 API, so add another API-version check to handle the
deprecations. Keeps warnings down.
- Switch debug-level to unsigned
- Don't shadow usings; the first TR type is enough
- The (bogus) return values were commented as // NOTREACHED,
but still yield unreachable code warnings. Drop them
instead, and rely on the compiler understanding [[noreturn]]
on parser.usage().
- Don't use this if we don't need it (QObject::tr is static).
- C++14 allows (copy) binding to arbitrary expresstions in lambda's,
so detach from this.
When using a custom partition layout with partition sizes in %, it can
be useful to set an upper limit to the partition size.
For instance, using a 20% size for the `/` partition will create a 24G
partition on a 120GB drive, but a 200GB partition on a 1TB drive, which
is not useful, and could be avoided by setting a maximum partition size.
This commit adds the `maxSize` parameter (with a default value of 100%).
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
- Using project() to set up the version is idiomatic for CMake
and more standardised than doing it by hand. Do retain the
RC flag, because that's used in other parts of versioning.
- When environment is empty, use default values from spec
- Search in application-named subdirs first (but keep previous
behavior of also searching directly in the named dirs)
- Don't consider empty XDG_* elements
- Settings XDG_DATA_DIRS=":" would yield an empty list of extra
directories to check; don't bother setting haveExtraDirs for that.
- When the manual partitioning page exists, it reacts to
changes in a bunch of models; these models can be changed
repeatedly from the choice page.
- the manual partitioning page really only needs to deal with
the relevant selections at the moment it is instantiated.
- This initial bit of code re-uses the *dont-chroot* setting;
it may need to be made independent.
- This branch will use `isSetupMode()` to adjust user-visible
strings to match the intended use.
SEE #1100
- rsync reports its own progress, and reports on files that
find -type f doesn't. This meant that the numbers didn't
match what was stored in entry.total
- The ir-phase adds files to be handled; to-phase happens once
ir-phase is over and the remaining files are processed.
By adding the to-phase files, percentages over 100% were
reported (in part because the number of files doesn't match).
- Update expected entries total from rsync output.
- Re-jig computation of how done everything is: tally it
up in integers, and do only one global progress percentage.
- The mismatch between "ir-chk" and the comment "to-check" led me
to check (ha!) the output of rsync, and it outputs "to-chk"
during small transfers; make sure the comment reflects what
is actually being used to track progress (which is "ir-chk").
- After the BootLoader model is reset, if a bootloader location
has been selected before, try to find it in the (now-reset)
model to preserve the selection.
- clear() signals modelReset(), which is true, but inconvenient
when we do a bunch of changes afterwards. Block signals,
and rely on own signaling when all of the changes are done.
- Keep blocking signals while updating the model, since the row
appends otherwise trigger a change in the connected combo box.
- For unsafe installations (compile-time option), make sure
things fail before partitions are actually written, unless
the other option is also turned off.
- This is a compile-time choice, and off by default. This may be useful
for developers that need to get through installation to a different
partition on their root drive.
- Add an option to avoid actually doing unsafe things. This is an extra
safeguard; you need to turn on one and turn off the other option to
really be unsafe.
- Avoid crash due to invalid iterator, when modules
are removed due to missing requirements.
- Simplify code, factor out the determination of
which required modules are missing.
- Load instances list in a separate method
- Load sequence list in a separate method
- Don't rely on QASSERT, explicitly throw if something is missing.
- This was commented out to combat the crash in device->type()
- I believe the crash was caused by double-deletion, which was
fixed in 2092ec3c9a by not re-
parenting an immutable copy of something.
- Restore the button-fix, since we need that to keep the
*create* button in-sync with the selected partition.
FIXES#1097
As requested, this commit adds a new configuration option to the
partition.conf file, name `efiSystemPartitionSize`.
When this option is absent, the default size of 300MiB will be used.
Fixes#1090
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
In order to allow the use of these functions across the whole partition
module and keep all partition size-related functions in the same
namespace, this commit moves them to PartUtils.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
This commit creates a _KiB operator for future use by the partition
module.
It also fixes a typo in one instance of MiBtoBytes(), requiring a couple
extra fixes.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
In order to be able to parse partition size strings using the same
functions across the partition module, the parseSizeString() function is
exported to the PartUtils namespace.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
- Make some methods that are called mostly as slots, actual slots,
instead of going through extra lambdas.
- Use QOverload<>::of for disambiguation instead of homebrew casts.
- Provide a convenience method that names a Partition* with the
best human-readable name we can find (worst-case, spit out a
pointer representation which will at least help figure out
the identity of the Partition*).
- These methods are used for multi-page view-steps, which are rare.
For all the others, just drop the empty implementation and defer
to the base class.
- Next was enabled early; presumably to cover the case that no requirements
were checked and the requirements checker never emitted an update signal.
Drop that since the module manager is now responsible for doing that checking.
- Can't re-parent across threads easily
- If device is made by immutableDeviceCopy(), then it's still owned by the
PartitionCoreModule; giving it away to the widget is not a good idea.
- The NAM is being created from a method call on the GeneralRequirements
object in the requirements-checking thread, while the GR object itself
was created in a different thread. This cross-thread parenting
produces a warning, and we don't need the parent relationship here
anyway.
- If a distro provides an install-scenario that doesn't provide a DM,
(e.g. via netinstall) then that should be ok; if there **is** a DM
it should be configured.
FIXES: #1095
Due to changes to the FileSsytem::typeForName() function, more
processing is needed to deal with locales and different cases.
This is done by refactoring the findFS() function, initially located in
the PartitionViewStep class, and making it available to the whole module.
Additionnally, more checks have been implemented regarding the use of
global storage in the PartitionLayout class, and the filesystem types
now use the correct FileSystem::Type, as requested.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
- The default window title in the designer file wasn't a good string
to translate. Use one of the titles instanced from elsewhere.
- The window titles set in subclasses were not translatable.
FIXES#1092
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>
- Move the actual checking into a separate object with some lifecycle-
management signals.
- Right now this is still single-threaded and blocking, so no net gain.
- Strings like "{} the {} with {}" are terrible for translators:
- no context
- no possibility to re-order grammatical units
- substituting in English parts-of-speech is going to make a mess
- Write the strings out with explicitly named substitutions,
no part-of-speech substitution, and better formatting.
- Add a (superfluous, since they don't have their own signals or slots)
Q_OBJECT macro to the VG jobs, to silence a Transifex warning (this
does make sure that the tool knows about the context for the translated
messages)
-----BEGIN PGP SIGNATURE-----
iHUEABEIAB0WIQTnwx6uJD15hBW87wASjwCHPgWvHQUCXGLH4QAKCRASjwCHPgWv
HeCzAP4/cwoZOBtOFAdDy6IlolCC42wAyTdW8NOrA8A7jNmETAD/bIsYGRlVEQeG
i9CW7IgRLRjlSM+hJPVYY8GYbF3k0Us=
=0y3i
-----END PGP SIGNATURE-----
Merge tag 'v3.2.4' of https://github.com/calamares/calamares into development
Release v3.2.4
- The test wants to read settings.conf, but by default it's run
from way inside the build dir, where there is no such file.
Go looking for one (but not too far).
- Part of the tests checks that the example configuration
is not empty. So uncomment the example. (Distro's should
not be installing the example configs, and this one in
particular needs to be customized).
- Store changes to the selected swap-choice when the combobox changes
- Use that member instead of dereferencing the combobox
This avoids nullptr crashes when the combobox isn't even created
(e.g. when there is only one swap choice).
- drop the localized comparisons; that's just confusing
- warn when no default FS is set (then use ext4)
- fix case-insensitive fallback; it used fsType, which was
set to Unknown in the for loop.
- Make the explanations about 3 times as wide as the text-boxes
that they are explaining. This is partly moot because the
text-boxes have fixed pixel sizes in the designer file, but keep
it flexible for now.
- Using the assignment-operator just generates blank lines.
- Using QLog with a log-level avoids the cDebug()-style special
handling of warnings and errors (useless here, but may as well
fix code style).
When using the `rawfs` module for copying data, it may be useful to
save the source device used for later checks or actions. This commit
therefore adds a `source` field to each corresponding partition entry in
global storage, so that this information can be retrieved later during
the installation process.
Another small improvement is that global storage is now modified only
once (it was previously modified as many times as there were entries
processed by the `rawfs` module).
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
When choosing `systemd-boot` as the bootloader, numerous problems
occurred:
- the kernel and initrd were not copied to the EFI System Partition,
and therefore could not be reached by the bootloader
- the fallback entry used the default initramfs image instead of the
fallback image
`systemd-boot` provides the `kernel-install` utility, which
automatically copies the kernel + initramfs to the EFI partition, and
creates the corresponding bootloader entry.
Unfortunately, `kernel-install` cannot be used here as the module is not
executed in a chroot. As setting up one only for running a single
command would be overkill, this patch re-creates what `kernel-install`
usually does:
- copy the kernel and initramfs to their own subdirectory at the root of
the EFI partition
- create the corresponding entry configuration file
To this end, the `systemd-boot` installation code in the `bootloader`
module has been largely refactored, including removing a few duplicate
LOCs.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
In its current state, the 'rawfs' module requires the source partition
to be identified either by its mount point or device name, but using a
symlink to either one (e.g '/dev/disk/by-uuid/...') would fail.
This patch fetches the real path of source partition, allowing the use
of symlinks.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
When setting the size of a partition without indicating the unit, two
problems occur:
- the size is parsed as an integer, not as a string, hence the
configuration parsing fails
- the size parser doesn't recognize the fact that the size has no units
and defaults to 100%
This patch fixes the configuration parsing as well as the size string
parsing.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
When a partition doesn't have a minimum size in the partition layout
configuration, it defaults to using 100% of the available space.
This patch fixes this error by setting the minimum partition size to 0
when the attribute has been omitted.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
- Write out Int, Double
- Special-case empty lists
- Do objects (not lists of objects) correctly
Now passes the tests for all the example config files.
- The code in loadYaml was refactored out of the module-descriptor
loading code, but the variable names in the implementation were
not changed and still strangely specific to the prior task.
- Add global- and job-configurations for test runs.
- Add a driver script that sets up some assumptions on the host
system so that the tests can complete.
- The idea is that these tests together get a decent code-coverage
for the module.
- This is a driver script for running testmodule.py multiple times
with different global- and job-configurations.
- Usage: testpythonrun.sh <modulename>
- Run the script from the build-directory. It uses files from the
tests/ (source) subdirectory to drive the test runs.
- Only need to get the list of supported filesystems *once*,
not for each and every filesystem that is going to be unpacked.
- Be more Python-idiomatic.
In some cases, we might want to copy a filesystem as if we were using a
simple 'dd' command, in order to create an exact copy, down to the block
level.
This can be useful in particular when working with dm-verity for
checking the rootfs integrity: that way, we can make a direct copy of
the rootfs and its verity partition and keep the system usable.
This patch adds a new 'rawfs' module to calamares, making possible to
block-copy a filesystem to a block device.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
In some cases, e.g. when calamares is used as an "initial setup" tool,
we may want to user to go through all the configuration steps in order
to end up with a usable system.
Therefore, disabling the "Cancel" button can be useful in this case.
This commit adds an option to settings.conf which disables this button
when set to "true". If the option is not present in the settings file,
the default behavior ("Cancel" button enabled & visible) is enforced.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>