Skip to content

Commit

Permalink
oem-factory-reset: Stop adding leading blank lines in 'passphrases' msg
Browse files Browse the repository at this point in the history
We're adding leading blank lines, which makes the prompt look odd and
now have to be removed later.  Just stop adding the leading blank
lines.

Signed-off-by: Jonathon Hall <[email protected]>
  • Loading branch information
JonathonHall-Purism committed Dec 6, 2024
1 parent c00c036 commit 86a6158
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions initrd/bin/oem-factory-reset
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ if [[ "$SKIP_BOOT" == "n" ]]; then
fi

# passphrases set to be empty first
passphrases="\n"
passphrases=""

# Prepare whiptail output of configured secrets
if [ -n "$luks_new_Disk_Recovery_Key_passphrase" -o -n "$luks_new_Disk_Recovery_Key_passphrase_desired" ]; then
Expand Down Expand Up @@ -1406,14 +1406,11 @@ fi

# Show configured secrets in whiptail and loop until user confirms qr code was scanned
while true; do
whiptail --msgbox "
$(echo -e "$passphrases" | fold -w $((WIDTH - 5)))" \
whiptail --msgbox "$(echo -e "$passphrases" | fold -w $((WIDTH - 5)))" \
$HEIGHT $WIDTH --title "Configured secrets"
# strip the initial newline of passphrases
qr_code=$(echo -e "$passphrases" | sed '1s/^\n//')
#Tell user to scan the QR code containing all configured secrets
echo -e "\nScan the QR code below to save the secrets to a secure location"
qrenc "$qr_code"
qrenc "$(echo -e "$passphrases")"
# Prompt user to confirm scanning of qrcode on console prompt not whiptail: y/n
echo -e -n "Please confirm you have scanned the QR code above and/or written down the secrets? [y/N]: "
read -n 1 prompt_output
Expand Down

0 comments on commit 86a6158

Please sign in to comment.