libreboot

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit b5597e4e74999886a532e71251be9571b0f748a8
parent aeca8fa33133b65598ea99b8988e74d7d2a9c832
Author: Paul Kocialkowski <contact@paulk.fr>
Date:   Sun, 25 Dec 2016 16:46:56 +0100

cros-scripts: cros-boot-keys: Confirm overriding keys when generating

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>

Diffstat:
projects/cros-scripts/install/cros-boot-keys | 34++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+), 0 deletions(-)

diff --git a/projects/cros-scripts/install/cros-boot-keys b/projects/cros-scripts/install/cros-boot-keys @@ -43,6 +43,38 @@ usage() { printf " VBOOT_TOOLS_PATH - Path to vboot tools\n" >&2 } +keys_override_confirm() { + local override=0 + local confirm + + for key in $KEYS + do + if [ -f "$VBOOT_KEYS_PATH/$key.$VBPUBK" ] || [ -f "$VBOOT_KEYS_PATH/$key.$VBPRIVK" ] + then + override=1 + fi + done + + for keyblock in $KEYBLOCKS + do + if [ -f "$VBOOT_KEYS_PATH/$keyblock.$KEYBLOCK" ] + then + override=1 + fi + done + + if [ $override -ne 1 ] + then + return 0 + fi + + printf "This is going to override keys stored in the following directory:\n" + printf " $VBOOT_KEYS_PATH\n" + printf "Press enter to confirm: " + + read confirm +} + generate() { local algorithms=$ALGORITHMS local subkeys=$SUBKEYS @@ -53,6 +85,8 @@ generate() { local privkey local mode + keys_override_confirm + for key in $KEYS do algorithm=$( echo "$algorithms" | sed "s/$REGEXP/\1/g" )