# defaults ALTERNATIVE_PRIORITY = "10" ALTERNATIVE_LINK = "${bindir}/${ALTERNATIVE_NAME}" update_alternatives_postinst() { update-alternatives --install ${ALTERNATIVE_LINK} ${ALTERNATIVE_NAME} ${ALTERNATIVE_PATH} ${ALTERNATIVE_PRIORITY} } update_alternatives_postrm() { update-alternatives --remove ${ALTERNATIVE_NAME} ${ALTERNATIVE_PATH} } def update_alternatives_after_parse(d): import bb if bb.data.getVar('ALTERNATIVE_NAME', d) == None: raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_NAME" % bb.data.getVar('FILE', d) if bb.data.getVar('ALTERNATIVE_PATH', d) == None: raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_PATH" % bb.data.getVar('FILE', d) python __anonymous() { update_alternatives_after_parse(d) } python populate_packages_prepend () { pkg = bb.data.getVar('PN', d, 1) bb.note('adding update-alternatives calls to postinst/postrm for %s' % pkg) postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) if not postinst: postinst = '#!/bin/sh\n' postinst += bb.data.getVar('update_alternatives_postinst', d, 1) bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) postrm = bb.data.getVar('pkg_postrm_%s' % pkg, d, 1) or bb.data.getVar('pkg_postrm', d, 1) if not postrm: postrm = '#!/bin/sh\n' postrm += bb.data.getVar('update_alternatives_postrm', d, 1) bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d) } /table>
summaryrefslogtreecommitdiff
path: root/meta/classes/tmake.bbclass
blob: 05b82e496def17f0ec4f3b5824a66a2290db3cfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77