From f06867306e43d6f2e7ca07553361722a60395d79 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Sun, 1 Sep 2024 21:01:04 -0400 Subject: [PATCH] init: make sure config.user is overriden only with new values so that going DEBUG/undoing can work reproducibly Signed-off-by: Thierry Laurion --- initrd/init | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/initrd/init b/initrd/init index 8eccbff0..a33e601c 100755 --- a/initrd/init +++ b/initrd/init @@ -140,8 +140,14 @@ fi # # Values in user config have higher priority during combining thus effectively # changing the value for the rest of the scripts which source /tmp/config. -echo "export CONFIG_TPM=\"$CONFIG_TPM\"" >> /etc/config.user -echo "export CONFIG_TPM2_TOOLS=\"$CONFIG_TPM2_TOOLS\"" >> /etc/config.user + +#Only set CONFIG_TPM and CONFIG_TPM2_TOOLS if they are not already set in /etc/config.user +if ! grep -q 'CONFIG_TPM=' /etc/config.user; then + echo "export CONFIG_TPM=\"$CONFIG_TPM\"" >> /etc/config.user +fi +if ! grep -q 'CONFIG_TPM2_TOOLS=' /etc/config.user; then + echo "export CONFIG_TPM2_TOOLS=\"$CONFIG_TPM2_TOOLS\"" >> /etc/config.user +fi # CONFIG_BASIC was previously CONFIG_PUREBOOT_BASIC in the PureBoot distribution. # Substitute it in config.user if present for backward compatibility.