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 <javier.viguera@digi.com>
This commit is contained in:
parent
75f2c00025
commit
b2abb5bc80
|
|
@ -317,6 +317,29 @@ format_emmc_block() {
|
||||||
fi
|
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
|
# Main
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Setup the environment.
|
# Setup the environment.
|
||||||
|
|
@ -409,12 +432,17 @@ if [ -n "${update_package_bool}" ]; then
|
||||||
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
|
||||||
log "Update package location: ${update_package}"
|
# Give some time for the devices to settle down
|
||||||
# Mount external disks.
|
|
||||||
sleep 5
|
sleep 5
|
||||||
mount_external_disks
|
mount_external_disks
|
||||||
# Mount update partition.
|
|
||||||
mount_partition update "${UPDATE_MOUNT_DIR}"
|
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.
|
# Execute the progress binary.
|
||||||
progress -wp &
|
progress -wp &
|
||||||
# Execute the software update.
|
# Execute the software update.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue