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:
Luca Weiss 2018-12-25 17:59:18 +01:00 committed by Oliver Smith
parent 23df933db4
commit 747ccfdd75
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
3 changed files with 9 additions and 0 deletions

View file

@ -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):
"""