recovery-initramfs: add retry when searching SWU package file
This commit adds a retry to the swu_package_path function of the recovery-initramfs-init script. It has been seen that with some USB memory stick a retry is necessary to mount the external storage device containing the SWU package. If the SWU package file is found before the max retries is reached the loop will be exited and the SWU installation will start. If max retry is reached and the SWU package wasn't found it finishes with an error. Signed-off-by: Mike Engel <Mike.Engel@digi.com> https://onedigi.atlassian.net/browse/DEL-9908
This commit is contained in:
parent
70ec1a8630
commit
190df56f4e
|
|
@ -364,19 +364,29 @@ swu_package_path() {
|
|||
# Check whether the package is local and get the absolute path.
|
||||
if echo "${1}" | grep -qs '^file://'; then
|
||||
local pkg_name="$(basename ${1})"
|
||||
local success=false
|
||||
local retries=1
|
||||
local max_retries=10
|
||||
|
||||
for i in ${UPDATE_MOUNT_DIR} $(echo ${USB_MOUNT_DIR}/*); do
|
||||
echo $i | grep -qs "${USB_MOUNT_DIR}/\*" && continue
|
||||
if [ -f "${i}/${pkg_name}" ]; then
|
||||
swu_abspath="${i}/${pkg_name}"
|
||||
break
|
||||
while [ $success = false ] && [ $retries -le $max_retries ]; do
|
||||
for i in ${UPDATE_MOUNT_DIR} $(echo ${USB_MOUNT_DIR}/*); do
|
||||
echo $i | grep -qs "${USB_MOUNT_DIR}/\*" && continue
|
||||
if [ -f "${i}/${pkg_name}" ]; then
|
||||
swu_abspath="${i}/${pkg_name}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${swu_abspath}" ]; then
|
||||
echo "${swu_abspath}"
|
||||
success=true
|
||||
else
|
||||
sleep 1
|
||||
retries=$(( retries + 1 ))
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${swu_abspath}" ]; then
|
||||
echo "${swu_abspath}"
|
||||
else
|
||||
quit_with_error "Unable to find update package '${pkg_name}'"
|
||||
if [ -z "${swu_abspath}" ]; then
|
||||
quit_with_error "Unable to find update package '${pkg_name}' after ${max_retries} retries"
|
||||
fi
|
||||
else
|
||||
echo "${1}"
|
||||
|
|
@ -513,9 +523,6 @@ echo > /dev/mdev.seq
|
|||
echo > /dev/mdev.log
|
||||
mdev -d
|
||||
|
||||
# Give some time for the devices to settle down so mdev can mount all of them
|
||||
sleep 2
|
||||
|
||||
# Run all shell scripts in postinstall folder
|
||||
run-parts /etc/*-postinsts
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue