Merge branch 'thingos' into better-firmware-update

This commit is contained in:
Calin Crisan 2017-03-05 18:59:41 +02:00
commit 1fe1efaebe
3 changed files with 21 additions and 9 deletions

View File

@ -763,6 +763,7 @@ menu "External python modules"
source "package/python-pycli/Config.in"
source "package/python-pycparser/Config.in"
source "package/python-pycrypto/Config.in"
source "package/python-pycurl/Config.in"
source "package/python-pydal/Config.in"
source "package/python-pyelftools/Config.in"
source "package/python-pyftpdlib/Config.in"

View File

@ -20,12 +20,22 @@ import os
import subprocess
def get_os_version():
with open('/etc/version') as f:
lines = f.readlines()
lines = [l.strip().split('=', 1) for l in lines]
data = dict([(l[0], l[1].strip('"')) for l in lines])
return (data['os_name'], data['os_version'])
def get_all_versions():
try:
return subprocess.check_output('fwupdate versions', shell=True).strip().split('\n')
except Exception as e:
logging.error('failed to list versions: %s' % e)
raise Exception('failed to list versions: %s' % e)
def perform_update(version):
@ -35,19 +45,19 @@ def perform_update(version):
logging.info('stopping netwatch script')
os.system('/etc/init.d/S41netwatch stop')
logging.error('downloading firmware version %s' % version)
logging.info('downloading firmware version %s' % version)
if os.system('fwupdate download %s > /dev/null' % version):
logging.error('firmware download failed')
raise Exception('firmware download failed')
logging.error('extracting firmware')
logging.info('extracting firmware')
if os.system('fwupdate extract > /dev/null'):
logging.error('firmware extracting failed')
raise Exception('firmware extracting failed')
logging.error('flashing boot partition')
logging.info('flashing boot partition')
if os.system('fwupdate flashboot > /dev/null'):
logging.error('firmware flash boot failed')
raise Exception('firmware flash boot failed')
logging.error('rebooting')
logging.info('rebooting')
if os.system('fwupdate flashreboot > /dev/null'):
logging.error('firmware flash reboot failed')
raise Exception('firmware flash reboot failed')

View File

@ -92,6 +92,7 @@ sync
if which partprobe > /dev/null 2>&1; then
msg "re-reading sdcard partition table"
partprobe ${SDCARD_DEV}
sleep 1
fi
msg "mounting sdcard"