From 815ae32dde08faa74beec3731b5d826a65db9578 Mon Sep 17 00:00:00 2001 From: "Gerd v. Egidy" Date: Mon, 6 Jun 2022 12:36:16 +0200 Subject: [PATCH 1/2] fix parsing command line option when there is no default yaml file at all --- airootfs/usr/bin/sysrescue-configuration.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/airootfs/usr/bin/sysrescue-configuration.lua b/airootfs/usr/bin/sysrescue-configuration.lua index 5a6f3da..255ee9d 100755 --- a/airootfs/usr/bin/sysrescue-configuration.lua +++ b/airootfs/usr/bin/sysrescue-configuration.lua @@ -49,6 +49,16 @@ function item_in_list(item, list) return false end +-- Ensure that the given scope exists in the config table, create it if not +function ensure_scope(cfg_table, scopename) + if (cfg_table == nil) or (type(cfg_table) ~= "table") then + cfg_table = { } + end + if (cfg_table[scopename] == nil) or (type(cfg_table[scopename]) ~= "table") then + cfg_table[scopename] = { } + end +end + -- Return the number of items in a table function get_table_size(mytable) size = 0 @@ -279,12 +289,15 @@ for option, scope in pairs(cmdline_options) do optresult = search_cmdline_option(option, false) if optresult == true then print("- Option '"..option.."' has been enabled on the boot command line") + ensure_scope(config, scope) config[scope][option] = optresult elseif optresult == false then print("- Option '"..option.."' has been disabled on the boot command line") + ensure_scope(config, scope) config[scope][option] = optresult elseif optresult ~= nil then print("- Option '"..option.."' has been defined as '"..optresult.."' on the boot command line") + ensure_scope(config, scope) config[scope][option] = optresult end end From 85fa76051df0e2b5be2f3360ae1b7f1a959dac4d Mon Sep 17 00:00:00 2001 From: "Gerd v. Egidy" Date: Mon, 6 Jun 2022 13:34:09 +0200 Subject: [PATCH 2/2] don't throw an error on nonexistent config entries for "copytoram" "checksum" "loadsrm" This can happen when there is no config yaml at all, for example when booting via PXE --- patches/archiso-v43-07-yaml-config.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/archiso-v43-07-yaml-config.patch b/patches/archiso-v43-07-yaml-config.patch index ce5b265..533ee21 100644 --- a/patches/archiso-v43-07-yaml-config.patch +++ b/patches/archiso-v43-07-yaml-config.patch @@ -26,7 +26,7 @@ index 853652e..53215eb 100644 + if [[ "${value}" == 'true' ]]; then + echo "Entry '.global.${curentry}' enabled in config: value='${value}'" + eval "${curentry}='y'" -+ elif [[ "${value}" == 'false' ]]; then ++ elif [[ "${value}" == 'false' ]] || [[ "${value}" == 'null' ]]; then + echo "Entry '.global.${curentry}' disabled in config: value='${value}'" + else + echo "ERROR: Found invalid value for '.global.${curentry}': value='${value}'"