Commit graph

16 commits

Author SHA1 Message Date
Gerd v. Egidy e9549eba34 don't do certificate verification for https downloads in the lua script
it is usually run during initramfs: we don't have a CA database there, so
all https downloads would fail otherwise.

Not doing cert verification at this step is clearly documented, so no
unexpected security risk for the user.
2022-08-07 12:56:41 +02:00
Gerd v. Egidy 81db3b13db improve error message in case the lua script can't download a file
Now prints the actual error message from the http library instead of a
generic "Could not connect" message.
2022-08-07 12:53:16 +02:00
Gerd v. Egidy 533a4cab7e add cow_label and cow_directory options to the global scope of the yaml config file
Allows to set to set the persistent backing store options via the yaml config too and
not only through boot commandline options.
2022-08-05 22:05:02 +02:00
Gerd v. Egidy 815ae32dde fix parsing command line option when there is no default yaml file at all 2022-06-06 12:36:16 +02:00
Francois Dupoux cfcfd6dd7a Merge branch 'lua-config-once' into 'main'
execute sysrescue-configuration.lua only once

See merge request systemrescue/systemrescue-sources!193
2022-05-09 11:26:49 +00:00
Gerd v. Egidy e87660beeb execute sysrescue-configuration.lua only once
Before this patch sysrescue-configuration.lua was executed twice each boot:
(1) during initramfs stage (2) in the regular system as sysrescue-configuration.service

While in theory both runs should create the same output, this isn't guaranteed and
differences could appear for example because of network issues. Finding and debugging
these is difficult because the output of sysrescue-configuration.lua created during
initramfs isn't available anymore when the final system is running.

This patch lets sysrescue-configuration.lua just run once during initramfs. The
output JSON file is then written to the new tmpfs mounted dir /run/archiso/config/.
This dir is also made the new default location for sysrescue-effective-config.json.

A symlink from /etc/sysrescue/sysrescue-effective-config.json to the new location
is created for compatibility with previous releases.
2022-04-25 20:31:18 +02:00
Gerd v. Egidy b11a052e69 change logic of the sysrescuecfg boot command line option: merge instead of replace
When you set a "sysrescuecfg" option on the boot command line before this change,
only the files given on the boot command line were read, not the files in the
sysrescue.d dir. But previous versions of sysrescue-configuration.lua had a set of
built-in default values, these were still used.

Current sysrescue-configuration.lua does not include default values anymore, they
are now all in 100-defaults.yaml. So it is better to always read the default values
from the sysrescue.d dir and just merge files given with the sysrescuecfg option
additionally, with a higher priority.

The sysrescuecfg now also allows absolute paths for local files. When using relative
paths, the common sysrescue.d dirs are prefixed. In this case the file will usually
be loaded again, but at a higher priority.
2022-04-24 01:52:43 +02:00
Gerd v. Egidy 24529bbb58 change yaml config loading logic to full merge
Previously when loading a YAML config, it overrode single values on the second hierarchy level.
But on all deeper levels new values were completely overwritten. This was inconsistent and poses
a problem for config entries that use these levels, like the ca-trust or the in-development autoterminal.

This change implements full merging of dictionaries on all levels to solve this. Values in files later
in precedence overwrite previous values. If the the old and the new config values are both dictionaries,
then the hierarchy levels are merged down recursively.

You can remove a previously existing dict entry again in a later file by assigning it an empty value.

Also fix handling of invalid YAMLs: ignore them instead of aborting execution
2022-04-23 23:18:23 +02:00
Gerd v. Egidy a100257d96 Add script and config.yaml parameter for late-loading of SystemRescueModules 2022-03-27 14:07:38 +00:00
Francois Dupoux 860df60dab Fix the type of the default definition of parameter "ar_attempts" (#266) 2022-02-23 07:19:31 +00:00
Francois Dupoux c15d70c558 Added support for loading remote yaml configuration files over http/https (#254) 2022-01-30 09:17:14 +00:00
fdupoux 21bd2294db Update exit status if there are errors in /usr/bin/sysrescue-configuration.lua 2022-01-29 17:59:54 +00:00
Francois Dupoux 0f0d899552 Allow to use option sysrescuecfg to restrict which local yaml config files to process (#254) 2022-01-29 12:34:03 +00:00
fdupoux 520b80e65e Improve processing of options passed on the boot command line 2022-01-28 21:50:17 +00:00
Francois Dupoux 35bd8314f3 Use generic logic for overriding config entries from values in yaml config files (#251) 2022-01-28 20:34:23 +00:00
Francois Dupoux ca6bcd6548 Implement the primary configuration processing script in lua (#251) 2022-01-26 20:07:53 +00:00