diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2016-12-25 16:46:56 +0100 |
---|---|---|
committer | Leah Rowe <info@minifree.org> | 2017-01-15 14:24:46 +0000 |
commit | b5597e4e74999886a532e71251be9571b0f748a8 (patch) | |
tree | aed54337e85aa48833510dba62f7ee38ad4f43b5 /projects | |
parent | aeca8fa33133b65598ea99b8988e74d7d2a9c832 (diff) | |
download | librebootfr-b5597e4e74999886a532e71251be9571b0f748a8.tar.gz librebootfr-b5597e4e74999886a532e71251be9571b0f748a8.zip |
cros-scripts: cros-boot-keys: Confirm overriding keys when generating
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'projects')
-rwxr-xr-x | projects/cros-scripts/install/cros-boot-keys | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/projects/cros-scripts/install/cros-boot-keys b/projects/cros-scripts/install/cros-boot-keys index eed01c56..07ec2cb9 100755 --- 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" ) |