mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-28 13:46:32 +00:00
Merge branch 'thingos' into better-firmware-update
This commit is contained in:
commit
1fe1efaebe
@ -763,6 +763,7 @@ menu "External python modules"
|
|||||||
source "package/python-pycli/Config.in"
|
source "package/python-pycli/Config.in"
|
||||||
source "package/python-pycparser/Config.in"
|
source "package/python-pycparser/Config.in"
|
||||||
source "package/python-pycrypto/Config.in"
|
source "package/python-pycrypto/Config.in"
|
||||||
|
source "package/python-pycurl/Config.in"
|
||||||
source "package/python-pydal/Config.in"
|
source "package/python-pydal/Config.in"
|
||||||
source "package/python-pyelftools/Config.in"
|
source "package/python-pyelftools/Config.in"
|
||||||
source "package/python-pyftpdlib/Config.in"
|
source "package/python-pyftpdlib/Config.in"
|
||||||
|
@ -20,12 +20,22 @@ import os
|
|||||||
import subprocess
|
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():
|
def get_all_versions():
|
||||||
try:
|
try:
|
||||||
return subprocess.check_output('fwupdate versions', shell=True).strip().split('\n')
|
return subprocess.check_output('fwupdate versions', shell=True).strip().split('\n')
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error('failed to list versions: %s' % e)
|
raise Exception('failed to list versions: %s' % e)
|
||||||
|
|
||||||
|
|
||||||
def perform_update(version):
|
def perform_update(version):
|
||||||
@ -35,19 +45,19 @@ def perform_update(version):
|
|||||||
logging.info('stopping netwatch script')
|
logging.info('stopping netwatch script')
|
||||||
os.system('/etc/init.d/S41netwatch stop')
|
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):
|
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'):
|
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'):
|
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'):
|
if os.system('fwupdate flashreboot > /dev/null'):
|
||||||
logging.error('firmware flash reboot failed')
|
raise Exception('firmware flash reboot failed')
|
||||||
|
|
||||||
|
@ -92,6 +92,7 @@ sync
|
|||||||
if which partprobe > /dev/null 2>&1; then
|
if which partprobe > /dev/null 2>&1; then
|
||||||
msg "re-reading sdcard partition table"
|
msg "re-reading sdcard partition table"
|
||||||
partprobe ${SDCARD_DEV}
|
partprobe ${SDCARD_DEV}
|
||||||
|
sleep 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "mounting sdcard"
|
msg "mounting sdcard"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user