deviceinfo: add and require _codename (!1732)
deviceinfo_codneame holds the device's code name, so we can easily look it up in the finished postmarketOS installation by reading /etc/deviceinfo. Related: postmarketOS/pmaports#157
This commit is contained in:
parent
23df933db4
commit
747ccfdd75
|
@ -127,6 +127,7 @@ def generate_deviceinfo_fastboot_content(args, bootimg=None):
|
|||
|
||||
def generate_deviceinfo(args, pkgname, name, manufacturer, arch, has_keyboard,
|
||||
has_external_storage, flash_method, bootimg=None):
|
||||
codename = "-".join(pkgname.split("-")[1:])
|
||||
# Note: New variables must be added to pmb/config/__init__.py as well
|
||||
content = """\
|
||||
# Reference: <https://postmarketos.org/deviceinfo>
|
||||
|
@ -135,6 +136,7 @@ def generate_deviceinfo(args, pkgname, name, manufacturer, arch, has_keyboard,
|
|||
deviceinfo_format_version="0"
|
||||
deviceinfo_name=\"""" + name + """\"
|
||||
deviceinfo_manufacturer=\"""" + manufacturer + """\"
|
||||
deviceinfo_codename=\"""" + codename + """\"
|
||||
deviceinfo_date=""
|
||||
deviceinfo_dtb=""
|
||||
deviceinfo_modules_initfs=""
|
||||
|
|
|
@ -225,6 +225,7 @@ deviceinfo_attributes = [
|
|||
"format_version",
|
||||
"name",
|
||||
"manufacturer",
|
||||
"codename",
|
||||
"date",
|
||||
"dtb",
|
||||
"modules_initfs",
|
||||
|
|
|
@ -42,6 +42,12 @@ def sanity_check(info, path):
|
|||
" delete the deviceinfo_msm_refresher line in: " +
|
||||
path)
|
||||
|
||||
# "codename" is required
|
||||
codename = os.path.basename(os.path.dirname(path)).replace("device-", "")
|
||||
if "codename" not in info or info["codename"] != codename:
|
||||
raise RuntimeError("Please add 'deviceinfo_codename=\"" + codename +
|
||||
"\"' to: " + path)
|
||||
|
||||
|
||||
def deviceinfo(args, device=None):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue