Commit 04dc8069 authored by Corey Moyer's avatar Corey Moyer

Rewrite "get_os_release" function

parent 0a03d11d
......@@ -762,36 +762,22 @@ def parse_os_release():
def get_os_release():
distribution = version = architecture = build = project = device = builder_name = builder_version = ''
architecture = distribution = project = version = ''
os_release_info = parse_os_release()
if os_release_info is not None:
if 'NAME' in os_release_info:
distribution = os_release_info['NAME']
if 'ARCH' in os_release_info:
architecture = os_release_info['ARCH']
if 'ID' in os_release_info:
distribution = os_release_info['ID']
if 'PROJECT' in os_release_info:
project = os_release_info['PROJECT']
if 'VERSION_ID' in os_release_info:
version = os_release_info['VERSION_ID']
if 'VERSION' in os_release_info:
version = os_release_info['VERSION']
if 'LIBREELEC_ARCH' in os_release_info:
architecture = os_release_info['LIBREELEC_ARCH']
if 'LIBREELEC_BUILD' in os_release_info:
build = os_release_info['LIBREELEC_BUILD']
if 'LIBREELEC_PROJECT' in os_release_info:
project = os_release_info['LIBREELEC_PROJECT']
if 'LIBREELEC_DEVICE' in os_release_info:
device = os_release_info['LIBREELEC_DEVICE']
if 'BUILDER_NAME' in os_release_info:
builder_name = os_release_info['BUILDER_NAME']
if 'BUILDER_VERSION' in os_release_info:
builder_version = os_release_info['BUILDER_VERSION']
return (
distribution,
version,
architecture,
build,
distribution,
project,
device,
builder_name,
builder_version
version
)
......@@ -802,14 +788,10 @@ minidom.Element.writexml = fixed_writexml
############################################################################################
os_release_data = get_os_release()
DISTRIBUTION = os_release_data[0]
VERSION = os_release_data[1]
ARCHITECTURE = os_release_data[2]
BUILD = os_release_data[3]
PROJECT = os_release_data[4]
DEVICE = os_release_data[5]
BUILDER_NAME = os_release_data[6]
BUILDER_VERSION = os_release_data[7]
ARCHITECTURE = os_release_data[0]
DISTRIBUTION = os_release_data[1]
PROJECT = os_release_data[2]
VERSION = os_release_data[3]
DOWNLOAD_DIR = '/root/Downloads'
KODI_USER_HOME = os.environ.get('KODI_USER_HOME', '/root/.kodi')
CONFIG_CACHE = os.environ.get('CONFIG_CACHE', '/root/.cache')
......
......@@ -480,20 +480,14 @@ class updates:
systemid = self.oe.SYSTEMID
else:
systemid = "NOSTATS"
if self.oe.BUILDER_VERSION:
version = self.oe.BUILDER_VERSION
else:
version = self.oe.VERSION
url = '%s?i=%s&d=%s&pa=%s&v=%s&f=%s' % (
self.UPDATE_REQUEST_URL,
self.oe.url_quote(systemid),
self.oe.url_quote(self.oe.DISTRIBUTION),
self.oe.url_quote(self.oe.ARCHITECTURE),
self.oe.url_quote(version),
self.oe.url_quote(self.oe.VERSION),
self.oe.url_quote(self.hardware_flags),
)
if self.oe.BUILDER_NAME:
url += '&b=%s' % self.oe.url_quote(self.oe.BUILDER_NAME)
self.oe.dbg_log('updates::check_updates_v2', 'URL: %s' % url, 0)
update_json = self.oe.load_url(url)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment