From 2f02fc21c1207a02a8b006cee4f2132430ebf45e Mon Sep 17 00:00:00 2001 From: Francois Dupoux <2386566-fdupoux@users.noreply.gitlab.com> Date: Sat, 1 Jan 2022 18:27:06 +0000 Subject: [PATCH] Support for configuring early boot options using the yaml configuration files --- config.d/01-sysrescue.yaml | 3 ++ mkinitcpio.conf | 2 +- packages | 1 + patches/archiso-v43-07-yaml-config.patch | 43 ++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 patches/archiso-v43-07-yaml-config.patch diff --git a/config.d/01-sysrescue.yaml b/config.d/01-sysrescue.yaml index 60b8af6..16bac59 100644 --- a/config.d/01-sysrescue.yaml +++ b/config.d/01-sysrescue.yaml @@ -1,4 +1,7 @@ --- global: + copytoram: false + checksum: false + loadsrm: false dostartx: false nofirewall: false diff --git a/mkinitcpio.conf b/mkinitcpio.conf index 4ec98e7..c03540a 100644 --- a/mkinitcpio.conf +++ b/mkinitcpio.conf @@ -1,4 +1,4 @@ MODULES=(fuse) -BINARIES=(mount.ntfs) +BINARIES=(aq jq mount.ntfs) HOOKS=(base udev memdisk findroot archiso archiso_loop_mnt archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_kms block mdadm_udev modconf encrypt lvm2 filesystems keyboard) COMPRESSION="xz" diff --git a/packages b/packages index 64c57f2..d977753 100644 --- a/packages +++ b/packages @@ -1,3 +1,4 @@ +aq alsa-utils amd-ucode archinstall diff --git a/patches/archiso-v43-07-yaml-config.patch b/patches/archiso-v43-07-yaml-config.patch new file mode 100644 index 0000000..eff321b --- /dev/null +++ b/patches/archiso-v43-07-yaml-config.patch @@ -0,0 +1,43 @@ +diff --git a/archiso/initcpio/hooks/archiso b/archiso/initcpio/hooks/archiso +index 51dfcc1..fe709cf 100644 +--- a/archiso/initcpio/hooks/archiso ++++ b/archiso/initcpio/hooks/archiso +@@ -197,6 +197,38 @@ archiso_mount_handler() { + fi + fi + ++ echo ":: Attempt to read configuration from yaml files ..." ++ ++ if ls -l /run/archiso/bootmnt/config.d/*.yaml >/dev/null 2>/dev/null ++ then ++ echo "Found yaml files in /run/archiso/bootmnt/config.d" ++ for curfile in /run/archiso/bootmnt/config.d/*.yaml ++ do ++ echo "Parsing ${curfile} ..." ++ shortname=$(basename ${curfile}) ++ ++ # Attempt to find boolean entries in the yaml configuration file ++ for curentry in "copytoram" "checksum" "loadsrm" ++ do ++ if value=$(cat ${curfile} | aq -i yaml -o toml ".global.${curentry}" 2>/dev/null) ++ then ++ if [[ "${value}" == 'true' ]] || [[ "${value}" == 'y' ]] || [[ "${value}" == 'yes' ]] ++ then ++ echo "Found a valid value for '.global.${curentry}': value='${value}'" ++ eval "${curentry}='y'" ++ elif [[ "${value}" == 'false' ]] || [[ "${value}" == 'n' ]] || [[ "${value}" == 'no' ]] ++ then ++ echo "Found a valid value for '.global.${curentry}': value='${value}'" ++ eval "${curentry}=''" ++ else ++ echo "ERROR: Found invalid value for '.global.${curentry}': value='${value}'" ++ sleep 8 ++ fi ++ fi ++ done ++ done ++ fi ++ + if [[ "${checksum}" == "y" ]]; then + if [[ -f "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.sha512" ]]; then + msg -n ":: Self-test requested, please wait..."