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.
This commit is contained in:
Gerd v. Egidy 2022-08-05 22:05:02 +02:00
parent b85260c377
commit 533a4cab7e
2 changed files with 24 additions and 1 deletions

View file

@ -264,6 +264,8 @@ end
cmdline_options = {
['copytoram'] = "global",
['cow_label'] = "global",
['cow_directory'] = "global",
['checksum'] = "global",
['loadsrm'] = "global",
['dostartx'] = "global",

View file

@ -2,7 +2,7 @@ diff --git a/archiso/initcpio/hooks/archiso b/archiso/initcpio/hooks/archiso
index 853652e..53215eb 100644
--- a/archiso/initcpio/hooks/archiso
+++ b/archiso/initcpio/hooks/archiso
@@ -197,6 +197,39 @@ archiso_mount_handler() {
@@ -197,6 +197,60 @@
fi
fi
@ -39,6 +39,27 @@ index 853652e..53215eb 100644
+ fi
+ done
+
+ # read string values set by YAML config, only handle non-empty strings
+ for curentry in "cow_label" "cow_directory"
+ do
+ if value=$(jq --raw-output ".global.${curentry} // empty | tostring" ${jsonconfig} 2>/dev/null)
+ then
+ if [[ -n "${value}" ]] ; then
+ eval "${curentry}='${value}'"
+ fi
+ fi
+ done
+
+ # redo handling of cow_label, it could have changed due to yaml config
+ if [[ -n "${cow_label}" ]]; then
+ cow_device="/dev/disk/by-label/${cow_label}"
+ [[ -z "${cow_persistent}" ]] && cow_persistent="P"
+ elif [[ -n "${cow_device}" ]]; then
+ [[ -z "${cow_persistent}" ]] && cow_persistent="P"
+ else
+ cow_persistent="N"
+ fi
+
if [[ "${checksum}" == "y" ]]; then
if [[ -f "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.sha512" ]]; then
msg -n ":: Self-test requested, please wait..."