recovery init: allow several operations at once (update, key, wipe)

Allow to perform several recovery operations at the same time and set the right
order for them:
 1. New encrypted key
 2. Firmware update
 3. Wipe update partition

https://jira.digi.com/browse/DEL-3277
https://jira.digi.com/browse/DEL-3685

Signed-off-by: Tatiana Leon <tatiana.leon@digi.com>
This commit is contained in:
Tatiana Leon 2017-02-27 14:43:56 +01:00
parent 976d79db9c
commit 4085bc8904
1 changed files with 11 additions and 8 deletions

View File

@ -3,7 +3,7 @@
# #
# recovery-initramfs-init # recovery-initramfs-init
# #
# Copyright (C) 2016 by Digi International Inc. # Copyright (C) 2016, 2017 by Digi International Inc.
# All rights reserved. # All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
@ -408,17 +408,11 @@ for arg in ${COMMAND}; do
esac esac
done done
# Check if wipe update patition command is configured.
if [ -n "${wipe_update_bool}" ]; then
log "Wipe 'update' partition requested"
psplash_message "Erasing update partition..."
format_partition update
fi
# Check if encryption key command is configured. # Check if encryption key command is configured.
if [ -n "${encryption_key_bool}" ]; then if [ -n "${encryption_key_bool}" ]; then
log "Trustfence encryption key setup requested (new key: ${encryption_key:-random})" log "Trustfence encryption key setup requested (new key: ${encryption_key:-random})"
psplash_message "Configuring new encryption key..." psplash_message "Configuring new encryption key..."
psplash_progress "0"
trustfence-tool "--newkey${encryption_key:+=${encryption_key}}" trustfence-tool "--newkey${encryption_key:+=${encryption_key}}"
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then
psplash_progress "100" psplash_progress "100"
@ -432,6 +426,7 @@ fi
if [ -n "${update_package_bool}" ]; then if [ -n "${update_package_bool}" ]; then
log "Firmware update requested" log "Firmware update requested"
psplash_message "Updating firmware..." psplash_message "Updating firmware..."
psplash_progress "0"
if [ -z "${update_package}" ]; then if [ -z "${update_package}" ]; then
quit_with_error "Firmware update package not specified" quit_with_error "Firmware update package not specified"
else else
@ -462,6 +457,14 @@ if [ -n "${update_package_bool}" ]; then
fi fi
fi fi
# Check if wipe update patition command is configured.
if [ -n "${wipe_update_bool}" ]; then
log "Wipe 'update' partition requested"
psplash_message "Erasing update partition..."
psplash_progress "0"
format_partition update
fi
# End the recovery process. # End the recovery process.
clear_uboot_vars clear_uboot_vars
reboot_system reboot_system