connectcore-demo-example: fix firmware update from local web
Use the same command independently of the boot system. Fix the way dual boot is detected to use 'dualboot' U-Boot variable. Signed-off-by: Tatiana Leon <Tatiana.Leon@digi.com>
This commit is contained in:
parent
cab26c39e7
commit
d9e0146e41
|
|
@ -513,19 +513,15 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler):
|
|||
path = json.loads(data.decode("utf-8")).get("file", None)
|
||||
|
||||
log.debug("Update firmware with file %s", path)
|
||||
|
||||
if is_dual_system():
|
||||
cmd = "firmware-update-dual.sh %s" % path
|
||||
else:
|
||||
if not path.startswith(get_fw_store_path()):
|
||||
# Move the package to /mnt/update
|
||||
if not is_dual_system() and not path.startswith(get_fw_store_path())\
|
||||
and shutil.disk_usage(get_fw_store_path())[2] >= os.path.getsize(path):
|
||||
# Move the package to /mnt/update to avoid permission problems
|
||||
update_path = os.path.join(get_fw_store_path(), os.path.basename(path))
|
||||
if os.path.exists(update_path):
|
||||
os.remove(update_path)
|
||||
shutil.move(path, update_path)
|
||||
path = update_path
|
||||
cmd = "update-firmware --reboot-timeout=1 %s" % path
|
||||
|
||||
cmd = "update-firmware %s" % path
|
||||
log.debug("Update cmd: %s", cmd)
|
||||
|
||||
try:
|
||||
|
|
@ -806,8 +802,8 @@ def is_dual_system():
|
|||
Returns:
|
||||
Boolean: True for dual systems, False otherwise.
|
||||
"""
|
||||
res = exec_cmd("fdisk -l | grep recovery")
|
||||
return res[0] != 0
|
||||
res = exec_cmd("fw_printenv -n dualboot")
|
||||
return res[0] == 0 and res[1] == "yes"
|
||||
|
||||
|
||||
def get_fw_store_path():
|
||||
|
|
|
|||
Loading…
Reference in New Issue