- In code, add the necessary bool
- document meaning in the config file
- actually expand the full text if the entry is local and set to expanding-
by-default. This implementation is a bit lazy since it just pretends
to click on the toggle button.
- While here, reduce scope for UB by initializing POD members
- The arrows Up, Down, Right are used on toolbuttons, but
in the context of this module, those are directions with
meaning; give them better names.
- Because of #1268, the meaning of up- and down- may be swapped;
I'm not sure of which look makes the most sense. This is prep-
work for easily swapping the looks by using the meaningful names
instead.
SEE #1268
- we loop over all the entries anyway, so calculate allLicensesOptional
along the way (debatable whether std::none_of is clearer)
- always un-check the accept-box when resetting entries.
- Toggling the checkbox could disable the next button
because only the checked-state was used, instead of
the next-is-enabled-if-everything-is-optional member variable.
FIXES#1271
- Move retranslation to a separate slot to allow it to be
formatted nicely.
- Use calculated m_allLicensesOptional in retranslation.
- Untangle determining if all licenses are optional; std::none_of
returns true on an empty list.
- this isn't really a Calamares thing to decide, and anyway centering
on the desktop is kind of weird in multi-monitor setups and the
DesktopWidget is deprecated as well.
- Scenario: *keepDistribution* is true, and the existing file contains
a GRUB_DISTRIBUTION line **followed** by a commented-out GRUB_DISTRIBUTION
line.
- In that case, the commented-out line would change the flag back to
False, and we'd end up writing a second GRUB_DISTRIBUTION line at the end.
Prevent that: the flag can only go to "True" and then stays there.
Editorial: If your grub configuration would have tripped this up, then
you're doing something wrong. Clean up the configuration file first.
- If we update the line, then GRUB_DISTRIBUTION has been set
- If we don't update the line (e.g. because of *keepDistribution*)
then a comment doesn't count as "have seen that line".
This means that if we get to the end of the file, with only commented-
out GRUB_DISTRIBUTION lines, and *keepDistribution* is set, then we'll
still write a distribution line -- because otherwise it's not set at all.
- Previous fix would erase the distribution information (using an
empty string to flag 'preserve existing GRUB_DISTRIBUTION lines'),
but that is fragile. A distro might set that, and yet **not**
set a GRUB_DISTRIBUTION line, in which case it would end up with
a setup without any GRUB_DISTRIBUTION set.
- When a GRUB_DISTRIBUTION line is found, **then** check if it should
update the line or not. This way, we have a suitable distribution
to write if no GRUB_DISTRIBUTION is found at all.
- move the explicit checking for non-empty into a specific
(normal) password check
- leave only the-two-fields-are-equal outside of the password-
requirements framework
- having non-empty is the same as minLength 1, but gives a different
error message
- the two explicit checks are the ones that handle *two*
strings as special cases; all the other checks from
the password-requirements system only handle the one string.
- the explanations under and around the boxes is noisy,
hard to size correctly (viz. issue #1202)
- use tooltips in almost-all fields instead
- add placeholder text to be more suggestive
- since the wording of the checkbox itself (and the functionality)
is to enforce strong passwords, need to switch out some
logic and fix the wording of the documentation.
- The "convenience" method was no longer convenient, since
we now place strings on the buttons by default.
- While here, **name** the buttons so they can be themed.
- if the welcome module wasn't loaded (or loading otherwise failed)
then no text was set, leading to confusing screens with
buttons with icons but no label.
- If a module exists, and has unmet dependencies, then
that is only a problem if the module itself is *used*.
Merely existing is ok.
This triggers on FreeBSD, where partition isn't built, but
bootloader depends on partition -- so you can never start
Calamares on FreeBSD, because bootloader depends on something
non-existent.
Relax the check: just warn, and only fail if a non-existent
module is used (all those with unmet dependencies are considered
non-existent).
- Calamares scans **all** subdirs of the module-directory
for a module.desc and complains about those that don't have
a module.desc.
- For ./calamares -d runs from the build-directory, this
leads to a few complaints when some plugins have been
ignored (and so no module.desc is generated for them).
- Give the whole entry to file_copy, not just the
destination. This will allow file_copy to work
with local excludes.
- Pluck entry.destination out immediately, to keep
code changes minimal.
- Document the parameters.
- list_excludes() turns the extra mounts from global storage
into --exclude parameters for rsync; it doesn't do anything
with the destination parameter.
- while here rename to something more descriptive
- it's ok if item one creates directories where item two will write,
so don't check for existence of all directories on start-up.
Reported by ArcoLinux.
FIXES: #1252
This adds to the *machineid* module (which generates random UUIDs
for DBus and systemd) another key to configure generation of
a urandom pool in the target from the entropy in the host system.
- Improve documentation of the settings
- If sysconfigSetup is true, **only** setup sysconfig and ignore
the rest. This seems to be consistent with existing openSUSE-
derivative distro's, which set displaymanagers to something
nonsensical.
- the *mount* module inserts a rootMountPoint without trailing /
into global storage, so we can't assume that here. On the other
hand, the paths passed in to the Worker functions are absolute
paths -- adjust the tests to follow that.
- The code in Workers.cpp assumes that rootMountPoint ends in a /
so that it can have filenames appended easily; make the tests
fit that assumption, but still need to check that it is so in
production.
- refactor running the command into a helper function,
to deal with the regular if-command-failed-then-complain pattern.
- mark parameters as unused.
- move distinction about kind of DBus file up into the MachineIdJob
and remove the enum that marked it.
- Testing some of the functionality that's been added just now:
- copyfile fails, buggy implementation
- poolsize fails, buggy implementation
- removefile not tested
- read-urandom or copy-existing-file are implemented
- fairly chatty on failure
- needs tests (probably the implementation should be moved to
a separate file and unit-tested)
- keep the rootMountPoint and the path-with-random-data separate
instead of concatenating them at the beginning. Then we can
use the "clean" names also within the host system.
- this could be named isValid() instead, but basically the idea
is that this code makes sense:
JobResult r = do_thing();
if ( !r ) { /* Error happened! */ return r; }
/* Carry on .. */
- remove existing files for each kind of random-generation
that is enabled. There's a helper function for the case that
Cala is no longer setuid and needs help to remove those files
from the target (e.g. a setuid helper).
- Just use the existing rsync code, which can do both
files and directory trees.
- The existing code assumed we were always copying directories.
Now double-check beforehand.
- if a default DE is configured but the executable doesn't exist,
believe the .desktop file. Then use that, and warn if the
whole thing can not be found.
- for a DE entry which has a bad executable setting,
update the entry from the .desktop file using TryExec.
This assumes that the TryExec command is actually something
you might want to run.
- Moc generates Q_UNUSED(_a); which in turn (with clang) issues
a superfluous-semicolon warning. Existing code with automoc
uses utils/moc-warnings.h to turn off warnings that are issued
on moc code. Include it explicitly here because automoc isn't
applied.
- Sessions can be X11-sessions (living in xsessions) or Wayland-
(living in wayland-sessions). Look in both places.
- Refactor code a little to make it nicer to read.
- Drop the 1-argument QString constructor, it is suprising
- Drop the conversion to QString
- Add a toString() instead
- Drop tests for the removed API
- While here, apply code formatting to the tests
This is done to force consumers to update to strongly-typed
InstanceKeys.
- cover all the constructors
- Start with some tests that fail, showing bugs in the implementation
- Fix bug that "derp@derp" was creating a valid instance-key with
a bad module and id (need to use ::fromString() to get that
functionality).
- Extend tests with more bad cases.
- Refactor tests to simplify "this is bad" assertions.
- Things in libcalamares/ subdirectories are namespaced
according to that subdirectory (sometimes in namespace
Calamares, sometimes CalamaresUtils). Do that in modulesystem/ too.
- Do the async GeoIP checking in the async requirements-checking phase
- Do not return any requirements results -- we just need the async bit
- Drop the waiting widget, since it's not needed (done by the
requirements phase)
- If there is an item with id "" (empty), it is used as the
"no-package-selected" placeholder text.
- Existing code iterated over the abstract model and used the
name and description at the time the model was set -- but
by getting the name and description from the model, only
a single string was obtained instead of the full range
of translations.
- Therefore, when arriving on the page, the "no-package-selected"
information was displayed from the translation that was active
when the model was set.
Instead, extend the non-abstract model so we can find the no-package-
selected item and pass that explicitly to the page.
FIXES#1241
- Since the package chooser might be used more than once, or for
more specific items than "Packages", introduce a way to provide
specific strings for display.
- The only string needed is the ViewStep name, since the item with
id "" can be used for the no-selection item.
- My usual test environment has umask set to 022, but on one dev
box it is 002, leading to test failures (which show the test
was bad, not that the umask-setting code is bad)
- sometimes a slot is easier than a lambda. Introduce
a macro CALAMARES_RETRANSLATE_SLOT that calls a given
slot in an object on language change.
- extend the retranslator with support for calling slots:
- use Qt's signal/slot mechanism alongside the private
list of functions to call
- provide convenience for obtaining the retranslator of
an object.
- This helps give meaningful names to code chunks
- Gives clang-format something to work with
- Reduces indentation depth
I think this is a bit of a code-style opinion issue: big complicated
lambdas doing UI things just don't seem like a good idea.
- since we also need to *disable* the shortcuts, and should tell a
V1 slideshow that it no longer is running,
- use existing function to set the property to true / false depending.
- instead of changeState( true ) or changeStage( false ), use
meaningful enum names so that the code at the call site
becomes readable; make the boolean part internal to the
state-changing method.
- hangs unpredictably during testing
- replace with the Calamares process-invocation runCommand(), which is also
synchronous but doesn't hang (or, hasn't, in testing so far)
- The compile failure came from bad #include paths, so restoring
this interface declaration wasn't a fix.
- Reported to cause runtime failures on both KaOS and Manjaro.
If we don't have/need an image for the rootfs, we might want to
configure the `/` directory as a source for unpackfs. Unfortunately,
this raises an error:
- unpackfs first creates a temporary directory
- it then creates a subdirectory for each source, using the source
path's basename
- when the source is `/`, the basename is an empty string, therefore
the module tries to create an already existing directory
In order to prevent this error, we use the `os.makedirs` function with
parameter `exist_ok=True` instead of `os.mkdir`.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
- Synchronous download of a given URL; not something to
do from the GUI thread.
- Use it from the GeoIP service, which downloads in a
separate thread to do GeoIP lookups.
- Drop now-unused headers.
- Adjust tests for GeoIP to use network service
- The networking service is intended to wrap up use of
QNetworkAccessManager and others for consumption within
Calamares, and to provide some convenience functions
for internet access.
- Medium term, it may also monitor network access, so that
we can respond to changes in network availability during
installation.
Currently very minimal and undocumented.
- AppData and AppStream can be disabled independently of finding
their requirements (possibly useful if you want to ignore
AppStream even when it's installed in your build environment).
- Add a little top-level documentation about WITH_
- These don't have to be static methods of PackageItem, a free
function is more convenient.
- Since it's not API of PackageItem anymore, need to
- update tests not to use API
- do API-not-available warnings in consumers
- The smallest size image of the default (or, if there is no
default, the first) screenshot is used.
- Remote URLs are not supported by QPixmap, so most will not
load anyway.
- Use *appstream* as key in one of the items for the package-
chooser to load data from the AppStream cache in the system.
- Usable for some applications; for DE-selection not so much.
- Currently unimplemented.
- Put the implementation entirely in a separate file, keep the
not-supported one in PackageModel.cpp (but only in an #ifdef).
- Makes the various optional-data-sources more similar.
- Simplify the iteration by first determining which partitions
are mountable (at all).
- This guards against the very rare case that a partition
does not have a mountPoint at all (the if guarded against that)
where the lambda passed to sort() would get a KeyError.
Instead of having a special case for extra mounts to be processed right
after the rootfs, a better approach is to add them to the partitions
list, and then sort the list by mount point.
This way, we make sure every partition is mounted right when it is
needed: `/` is obviously mounted first, `/run` is mounted before
`/run/udev`, and so on.
The overall process is therefore more generic and should suit all
use-cases.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
- the "Select language" tooltip was applied to the form, so it would
show up inappropriately all over the place
- the buttons didn't have useful tooltips.
- having show*Url and donateUrl seems inconsistent, although
the show*Url settings were originally boolean-only.
- add "show" to the Donate button setting, to make them
all consistent (putting a boolean there will generate a
warning and hide the button, that's all).
- the generic (enum-based) setupButton() can handle all four
of the buttons, so setupLinks() can go away. Only the
(re)translation of the text on the button needs to be
done, so move that to the main RETRANSLATE.
- Handle buttons and their URL-opening in a more
general way with an enum; drop existing three-boot
method and special setupDonateButton()
- Doesn't compile because consumers haven't changed.
Currently, the `bytesToSectors()` function rounds a partition size to the
nearest MiB unit, which may lead to inconsistencies when a partition
is expected to only be a few KiB's.
This patch changes the behaviour of `bytesToSectors()` so that it aligns
on sector size, without rounding the partition size to a multiple of
1MiB.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Currently, all size units are expressed as KiB, MiB or GiB (resp. 2^10,
2^20 or 2^30).
In order to maximize compatibility and consistent results with other
partitioning tools, this commit adds support for sizes expressed as KB,
MB or GB (resp. 10^3, 10^6 or 10^9).
This change won't affect existing users, it simply adds a new option
that wasn't previously handled.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
- this is not entirely straightfoward, since we need
different constructor arguments for the objects
Calamares creates (no QVariantList& args, in particular).
Implement our own registerPlugin() and createInstance()
for that.
- work around a bug in K_PLUGIN_FACTORY_DECLARATION_WITH_BASEFACTORY
As the config files integer are now of type `QVariant::LongLong` instead
of `QVariant::Int`, requirements relying on this type were not parsed
correctly.
This patch fixes this, and adds an option to the python conversion to
take into account `QVariant::LongLong` types.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Currently, a number of configuration parsing-related functions and
classes use only `int` type for dealing with integers. Should the user
need a bigger integer value, this would result in an erroneous value
being used (`0`), as the correct value would overflow the 32-bits type.
In order to prevent these overflow, this patch replaces `int` with
`qint64` in the following functions & classes :
* CalamaresUtils::yamlScalarToVariant()
* CalamaresUtils::getInteger
* NamedSuffix
* PartitionSize
This way, sizes or other integer values greater than 2^31 (for signed
types) can be used.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
When the rootfs partition is read-only, mount points for the other
partitions cannot be created, therefore they need to be created in a
tmpfs, already mounted somewhere in `/`.
However, the extra mounts are only mounted at the end, which causes an
error as no tmpfs is currently mounted.
This patch makes sure all extra mounts are mounted right after the `/`
partition, allowing the use of a read-only rootfs.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
This variable is declared in `if m:`. Of course if this codepath doesn't
run, the variable is not declared an Python doesn't like this kind of
surprise...
Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
- If KPMcore is found -- it requires some other KDE Frameworks but
at least in pre-4.0 versions doesn't check very well for them --
then missing its dependencies is no cause for CMake failure.
Instead, log it nicely and suppress the module.
- stop compiler warnings with some judicious casting;
that's what you get when a container indexed by int
stored those indexes as quintptr.
- apply coding style
- do static initialization more carefully
- float -> qreal (double) because that's what the Qt API expects,
to reduce type-conversion warnings
- apply current coding style
- calamares_automoc() sets AUTOMOC, but also adds some flags
to avoid compilation warnings from the generated MOC code.
- drop weird hard-coded include paths
- Although milliseconds::count() is long long, we pass it to
a Qt interface that only takes int; let's assume we have
only a 32-bit count, since a timeout of 4 billion milliseconds
is roughly 46 days, which we'll just call "no timeout".
- Drop the round-trip of forming a JSON document from a QVariant,
then parsing the document into JSON objects and building a
model out of that. View the Variant directly.
- This is a fairly specialized class, for use only in the
whole-application where it ties in with the module system.
Move it to the application directory and slim down the UI library.
- Include it from the new location.
- Add UIC to Calamares (the application) because there's now
a designer-based widget in it.
- KDE and GNOME selection images were drawn by me for the bogus
package model, and should not be used.
- Keep Calamares logo though, even if it doesn't make much sense
to use it in package selection.
- Keep the no-selection image since it might be used more often,
but it's not very good.
- The ID and Screenshot entries might be weird in AppData (in particular,
a remove URL) so put those back under the control of Calamares even
when using AppData as the source of descriptions.
- Document all the static inline methods that do the work
- Fill up a QVariantMap from <name>, <summary> and <description><p>
elements, and use that to initialize the PackageItem.
- Doing a manual read of the XML, since existing appdata libraries
don't seem to have a convenient entry for what I need.
- Expand tests to loading AppData (currently, they fail).
- Massage the implementation a bit, don't insert a meaningless
copy of the key as the untranslated message.
- Add isEmpty() to check for presence of the untranslated message.
- Document API.
- Update tests.
- Add a FALLTHRU macro to annotate fallthrough situations in both
Clang and GCC,
- Annotate intentional fallthroughs.
- Add missing break which meant that the selection mode was
always multiple-selection.
- The tests should be run in C locale, otherwise the plain get()
function uses the current locale, which will fail (e.g. running
LANG=nl ./libcalamareslocaletest returns the Dutch strings for
plain get, which isn't what we expect).
- sr@latin is still special.