diff options
-rw-r--r-- | classes/sota.bbclass | 14 | ||||
-rw-r--r-- | classes/sota_sanity.bbclass | 42 |
2 files changed, 42 insertions, 14 deletions
diff --git a/classes/sota.bbclass b/classes/sota.bbclass index 5b06397..4422741 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass | |||
@@ -7,20 +7,6 @@ SOTA_CLIENT_PROV ??= "aktualizr-shared-prov" | |||
7 | SOTA_DEPLOY_CREDENTIALS ?= "1" | 7 | SOTA_DEPLOY_CREDENTIALS ?= "1" |
8 | SOTA_HARDWARE_ID ??= "${MACHINE}" | 8 | SOTA_HARDWARE_ID ??= "${MACHINE}" |
9 | 9 | ||
10 | # Translate old provisioning recipe names into the new versions. | ||
11 | python () { | ||
12 | prov = d.getVar("SOTA_CLIENT_PROV") | ||
13 | if prov == "aktualizr-auto-prov": | ||
14 | bb.warn('aktualizr-auto-prov is deprecated. Please use aktualizr-shared-prov instead.') | ||
15 | d.setVar("SOTA_CLIENT_PROV", "aktualizr-shared-prov") | ||
16 | elif prov == "aktualizr-ca-implicit-prov": | ||
17 | bb.warn('aktualizr-ca-implicit-prov is deprecated. Please use aktualizr-device-prov instead.') | ||
18 | d.setVar("SOTA_CLIENT_PROV", "aktualizr-device-prov") | ||
19 | elif prov == "aktualizr-hsm-prov": | ||
20 | bb.warn('aktualizr-hsm-prov is deprecated. Please use aktualizr-device-prov-hsm instead.') | ||
21 | d.setVar("SOTA_CLIENT_PROV", "aktualizr-device-prov-hsm") | ||
22 | } | ||
23 | |||
24 | IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}" | 10 | IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}" |
25 | IMAGE_CLASSES += " image_types_ostree image_types_ota" | 11 | IMAGE_CLASSES += " image_types_ostree image_types_ota" |
26 | 12 | ||
diff --git a/classes/sota_sanity.bbclass b/classes/sota_sanity.bbclass index 8e80acb..c6665a2 100644 --- a/classes/sota_sanity.bbclass +++ b/classes/sota_sanity.bbclass | |||
@@ -10,6 +10,32 @@ def sota_check_required_variables(status, d): | |||
10 | if not d.getVar(var): | 10 | if not d.getVar(var): |
11 | status.addresult("%s should be set in your local.conf.\n" % var) | 11 | status.addresult("%s should be set in your local.conf.\n" % var) |
12 | 12 | ||
13 | def sota_check_variables_validity(status, d): | ||
14 | var = d.getVar("OSTREE_BRANCHNAME") | ||
15 | if var != "": | ||
16 | for ch in var: | ||
17 | if not (ch >= 'a' and ch <= 'z' or ch >= 'A' and ch <= 'Z' or ch >= '0' and ch <= '9' or ch = '_' or ch == '-'): | ||
18 | status.addresult("OSTREE_BRANCHNAME Should only contain characters from the character set [a-zA-Z0-9_-].\n") | ||
19 | break | ||
20 | var = d.getVar("{SOTA_HARDWARE_ID") | ||
21 | if var != "": | ||
22 | for ch in var: | ||
23 | if not (ch >= 'a' and ch <= 'z' or ch >= 'A' and ch <= 'Z' or ch >= '0' and ch <= '9' or ch = '_' or ch == '-'): | ||
24 | status.addresult("SOTA_HARDWARE_ID Should only contain characters from the character set [a-zA-Z0-9_-].\n") | ||
25 | break | ||
26 | var = d.getVar("SOTA_CLIENT_FEATURES") | ||
27 | if var != "hsm" and var != "secondary-network" and var != "": | ||
28 | status.addresult("SOTA_CLIENT_FEATURES should be set to hsm or secondary-network.\n") | ||
29 | var = d.getVar("OSTREE_UPDATE_SUMMARY") | ||
30 | if var != "0" and var != "1" and var != "": | ||
31 | status.addresult("OSTREE_UPDATE_SUMMARY should be set to 0 or 1.\n") | ||
32 | var = d.getVar("OSTREE_DEPLOY_DEVICETREE") | ||
33 | if var != "0" and var != "1" and var != "": | ||
34 | status.addresult("OSTREE_DEPLOY_DEVICETREE should be set to 0 or 1.\n") | ||
35 | var = GARAGE_SIGN_AUTOVERSION | ||
36 | if var != "0" and var != "1" and var != "": | ||
37 | status.addresult("GARAGE_SIGN_AUTOVERSION should be set to 0 or 1.\n") | ||
38 | |||
13 | def sota_raise_sanity_error(msg, d): | 39 | def sota_raise_sanity_error(msg, d): |
14 | if d.getVar("SANITY_USE_EVENTS") == "1": | 40 | if d.getVar("SANITY_USE_EVENTS") == "1": |
15 | bb.event.fire(bb.event.SanityCheckFailed(msg), d) | 41 | bb.event.fire(bb.event.SanityCheckFailed(msg), d) |
@@ -52,3 +78,19 @@ python sota_check_sanity_eventhandler() { | |||
52 | 78 | ||
53 | return | 79 | return |
54 | } | 80 | } |
81 | |||
82 | # Translate old provisioning recipe names into the new versions. | ||
83 | python () { | ||
84 | prov = d.getVar("SOTA_CLIENT_PROV") | ||
85 | if prov == "aktualizr-auto-prov": | ||
86 | bb.warn('aktualizr-auto-prov is deprecated. Please use aktualizr-shared-prov instead.') | ||
87 | d.setVar("SOTA_CLIENT_PROV", "aktualizr-shared-prov") | ||
88 | elif prov == "aktualizr-ca-implicit-prov": | ||
89 | bb.warn('aktualizr-ca-implicit-prov is deprecated. Please use aktualizr-device-prov instead.') | ||
90 | d.setVar("SOTA_CLIENT_PROV", "aktualizr-device-prov") | ||
91 | elif prov == "aktualizr-hsm-prov": | ||
92 | bb.warn('aktualizr-hsm-prov is deprecated. Please use aktualizr-device-prov-hsm instead.') | ||
93 | d.setVar("SOTA_CLIENT_PROV", "aktualizr-device-prov-hsm") | ||
94 | } | ||
95 | |||
96 | |||