From b2abb5bc80b0a803eb2937139f0f1803d9850e83 Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Fri, 20 Jan 2017 17:34:09 +0100 Subject: [PATCH] recovery init: search update package in the different partitions Instead of using a hardcoded path to the SWU update package, just get the filename and search the file in the different mounted partitions (giving priority to the internal 'update' partition over other external media). https://jira.digi.com/browse/DEL-3466 Signed-off-by: Javier Viguera --- .../recovery-initramfs-init | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init index dbaf970b5..521116ab4 100644 --- a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init +++ b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init @@ -317,6 +317,29 @@ format_emmc_block() { fi } +#------------------------------------------------------------------------------ +# Function - swu_package_path +# +# Get absolute path of update package searching in local media +# +# @param ${1} - SWU package name +#------------------------------------------------------------------------------ +swu_package_path() { + for i in ${UPDATE_MOUNT_DIR} $(echo ${USB_MOUNT_DIR}/*); do + echo $i | grep -qs "${USB_MOUNT_DIR}/\*" && continue + if [ -f "${i}/${1}" ]; then + swu_abspath="${i}/${1}" + break + fi + done + + if [ -n "${swu_abspath}" ]; then + echo "${swu_abspath}" + else + quit_with_error "Unable to find update package '${1}'" + fi +} + # Main #------------------------------------------------------------------------------ # Setup the environment. @@ -409,12 +432,17 @@ if [ -n "${update_package_bool}" ]; then if [ -z "${update_package}" ]; then quit_with_error "Firmware update package not specified" else - log "Update package location: ${update_package}" - # Mount external disks. + # Give some time for the devices to settle down sleep 5 mount_external_disks - # Mount update partition. mount_partition update "${UPDATE_MOUNT_DIR}" + + # Check whether the package is local and get the absolute path + if echo "${update_package}" | grep -qs '^file://'; then + update_package="$(swu_package_path $(basename ${update_package}))" + fi + + log "Update package location: ${update_package}" # Execute the progress binary. progress -wp & # Execute the software update.