- Clang 8 can detect that there is no need for a return if all
previous paths already return. GCC 8 does not. Clang warns if
the unreachable return is there, GCC errors out if it isn't.
- Introduce a hack NOTREACHED that comments-out on Clang, and
marks as unreachable (but still present) on GCC.
- This might go away with an [[unreachable]] annotation or
similar.
- Although None will be filtered out already by unitsComparable(),
include it in the switch to avoid a warning .. then we can
drop the post-switch return since the switch covers all possible
values of the enum.
- Use unitsComparable where applicable
- Use SizeUnit instead of unit_t -- since this is a template
specialization, we have the more meaningful type name to
use, instead of the generic one.
- Not all kinds of units are comparable. Introduce a method
in PartitionSize to check for comparability (this could
also be a free method, but seems more tidy here because it
is specifically about comparing in the context of partition sizes).
- the switch handles all values of the enum and the compiler should
be smart enough to know that (therefore default isn't needed,
nor the return afterwards).
- Declaring namespace A::B is a C++17 extension, and Calamares
is C++14. Split the namespace declarations.
- While here, fix extra const warning as well.
src/modules/bootloader/main.py (install_secureboot): Run the configured
grubMkconfig command (should be `grub-mkconfig` or `grub2-mkconfig`) to
create `/boot/efi/EFI/$efi_bootloader_id/grub.cfg`. The sb-shim is just
a chainloader to GRUB 2, which expects a grub.cfg in that location, so
something has to create it or the installed system will not boot beyond
the GRUB rescue shell.
(install_grub): Fix misleading comment above the grubMkconfig call: it
is not the file specified in grubCfg that should be already filled out
by the grubcfg job module, that file is written by `grub*-mkconfig`
using `/etc/default/grub` as the input file. It is that input file
`/etc/default/grub` that should already be filled out by the grubcfg job
module. (The same input file is used in install_secureboot.)
- The output of subprocess is a bytes object, which needs to
be decoded so we can use it like a regular string (alternatively,
we could have changed more code to manipulate bytes, but eventually
we need a string to pass to a subsequent command anyway).
- Centralize the sanitizer so that it's consistent in different
environments.
- While here, add () to the sanitizer to avoid some distro's with
parenthesized names from creating weird EFI dirs.
- FIXES#934
- Whether this is really wanted depends on the distro, and I'm not
100% convinced the likely tags from Unicode are correct (or it'd
take a lot more data). In any case, starting Calamares in "NL"
gets me "nl_NL" as translation; presumably starting it in "BE"
will get me that as well (what about Les Wallons?)
- This also shows off that it's a real hack to have so much program
logic in the *widget* parts of each ViewStep. Longer-term,
a lot of functionality should go to the ViewStep itself, which
will then control the UI.
- Which translations are available is a global property
of Calamares itself, not of the plugins, so getting
the model of available translations should live there.
Move the relevant code (which is simple) from the
Welcome module.
- Use namespace CalamaresUtils::Locale consistently for this service.
- Move locale-related non-GUI support code from the Welcome module
to libcalamares; these are generally useful. Both Label (naming a locale)
and LabelModel (managing a bunch of those Labels) have been moved.
- Lookup country data based on enum or 2-letter code
- No data yet, so return only stubs
- The (generated) data tables are not listed as sources because
they are #include'd by the API implementation; they're full of
otherwise-unused static tables, so don't make sense to compile
separately.
- While here, tidy up the CMakeLists a bit to reduce the number
of superfluous variables.
- Continuing the notion that libcalamares should provide
(non-GUI) services for modules, add a locale service.
- This will, unfortunately, roughly duplicate Qt's QLocale
database, but in a form that is public and more readable.