From 16cfb28aa9873e37710a35bd345c18834d663675 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sat, 19 Oct 2019 22:52:56 +0300 Subject: [PATCH] fwupdate: fix partition detection when /boot is unmounted --- board/common/overlay/sbin/fwupdate | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/board/common/overlay/sbin/fwupdate b/board/common/overlay/sbin/fwupdate index 2529b54fd6..a926be517f 100755 --- a/board/common/overlay/sbin/fwupdate +++ b/board/common/overlay/sbin/fwupdate @@ -97,9 +97,16 @@ function cleanup_on_exit() { #### disk & partition devices #### BOOT_DEV=$(mount | grep /boot | cut -d ' ' -f 1) -ROOT_DEV=${BOOT_DEV:0:-1}2 -DATA_DEV=${BOOT_DEV:0:-1}3 -DISK_DEV=$(mount | grep /boot | cut -d ' ' -f 1) +if [[ -n "${BOOT_DEV}" ]]; then + ROOT_DEV=${BOOT_DEV:0:-1}2 + DATA_DEV=${BOOT_DEV:0:-1}3 +else # boot partition not mounted, trying with data partition + DATA_DEV=$(mount | grep /data | cut -d ' ' -f 1) + BOOT_DEV=${DATA_DEV:0:-1}1 + ROOT_DEV=${BOOT_DEV:0:-1}2 +fi + +DISK_DEV=${BOOT_DEV} if [[ "${ROOT_DEV}" =~ ^([/a-z0-9]+)(p[0-9])$ ]]; then # e.g. /dev/mmcblk0p2 DISK_DEV=${BASH_REMATCH[1]} elif [[ "${ROOT_DEV}" =~ ^([/a-z0-9]+)([0-9])$ ]]; then # e.g. /dev/sdc2 @@ -431,8 +438,12 @@ function extract_status() { fi fi - if [[ -f ${FW_FILE_EXTR} && -f ${ROOT_INFO_FILE} ]]; then - echo "done" + if [[ -f ${FW_FILE_EXTR} ]]; then + if [[ -f ${ROOT_INFO_FILE} ]]; then + echo "done" + else + echo "running" + fi fi }