From ea5d948819c2feb6679d79fa7774d0538673119a Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Thu, 3 Apr 2025 13:00:49 -0400 Subject: [PATCH] oem-factory-reset: GPG Comment is required in current code base, not optional. Change Questionnaire and validate size properly Fixes https://github.com/linuxboot/heads/issues/1949 Signed-off-by: Thierry Laurion --- initrd/bin/oem-factory-reset | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/initrd/bin/oem-factory-reset b/initrd/bin/oem-factory-reset index 22f1bba5..916c2d6b 100755 --- a/initrd/bin/oem-factory-reset +++ b/initrd/bin/oem-factory-reset @@ -1164,13 +1164,13 @@ if [ "$use_defaults" == "n" -o "$use_defaults" == "N" ]; then } done - echo -e "\nEnter Comment (Optional, to distinguish this key from others with same previous attributes. Must be smaller then 60 characters):" - read -r GPG_USER_COMMENT - while [[ ${#GPG_USER_COMMENT} -gt 60 ]]; do - { - echo -e "\nEnter Comment (Optional, to distinguish this key from others with same previous attributes. Must be smaller then 60 characters):" - read -r GPG_USER_COMMENT - } + echo -e "\nEnter Comment (Required: Use this to distinguish this key from others, e.g., its purpose or usage context. Must be 1-60 characters):" + while true; do + read -r GPG_USER_COMMENT + if [[ ${#GPG_USER_COMMENT} -ge 1 && ${#GPG_USER_COMMENT} -le 60 ]]; then + break + fi + echo -e "\nComment must be 1-60 characters long. Please try again:" done fi