diff options
-rw-r--r-- | meta/classes/image-postinst-intercepts.bbclass | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/meta/classes/image-postinst-intercepts.bbclass b/meta/classes/image-postinst-intercepts.bbclass new file mode 100644 index 0000000000..ed30bbd98d --- /dev/null +++ b/meta/classes/image-postinst-intercepts.bbclass | |||
@@ -0,0 +1,23 @@ | |||
1 | # Gather existing and candidate postinst intercepts from BBPATH | ||
2 | POSTINST_INTERCEPTS_DIR ?= "${COREBASE}/scripts/postinst-intercepts" | ||
3 | POSTINST_INTERCEPTS_PATHS ?= "${@':'.join('%s/postinst-intercepts' % p for p in '${BBPATH}'.split(':'))}:${POSTINST_INTERCEPTS_DIR}" | ||
4 | |||
5 | python find_intercepts() { | ||
6 | intercepts = {} | ||
7 | search_paths = [] | ||
8 | paths = d.getVar('POSTINST_INTERCEPTS_PATHS').split(':') | ||
9 | overrides = (':' + d.getVar('FILESOVERRIDES')).split(':') + [''] | ||
10 | search_paths = [os.path.join(p, op) for p in paths for op in overrides] | ||
11 | searched = oe.path.which_wild('*', ':'.join(search_paths), candidates=True) | ||
12 | files, chksums = [], [] | ||
13 | for pathname, candidates in searched: | ||
14 | if os.path.isfile(pathname): | ||
15 | files.append(pathname) | ||
16 | chksums.append('%s:True' % pathname) | ||
17 | chksums.extend('%s:False' % c for c in candidates[:-1]) | ||
18 | |||
19 | d.setVar('POSTINST_INTERCEPT_CHECKSUMS', ' '.join(chksums)) | ||
20 | d.setVar('POSTINST_INTERCEPTS', ' '.join(files)) | ||
21 | } | ||
22 | find_intercepts[eventmask] += "bb.event.RecipePreFinalise" | ||
23 | addhandler find_intercepts | ||