key-init: If time resets, tell user to set it, but allow skipping

The 'warn' message was not very effective, because change-time.sh
clears the screen right after.  Prompt with whiptail instead, which
also lets the user know what's happening before we drop them into a
series of prompts.

Let the user skip changing time if they really want to.  While they
usually should set the time, it's rather frustrating if Heads forces
them to go through these prompts when they don't want to.

Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
This commit is contained in:
Jonathon Hall 2024-09-06 08:44:11 -04:00 committed by Thierry Laurion
parent cbd1f285c6
commit 62c8366d20
No known key found for this signature in database
GPG Key ID: 9A53E1BB3FF00461

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -e -o pipefail
. /etc/functions
. /etc/gui_functions
TRACE_FUNC
@ -9,8 +10,11 @@ TRACE_FUNC
# Good system clock is required for GPG to work properly.
# if system year is less then 2024, prompt user to set correct time
if [ "$(date +%Y)" -lt 2024 ]; then
warn "System time is incorrect. Please set the correct time."
change-time.sh
if whiptail_warning --title "System Time Incorrect" \
--yesno "The system time is incorrect. Please set the correct time." \
0 80 --yes-button Continue --no-button Skip --clear; then
change-time.sh
fi
fi
# Import user's keys if they exist