diff options
author | Richard Purdie <richard@openedhand.com> | 2006-07-21 10:10:31 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2006-07-21 10:10:31 +0000 |
commit | b2f192faabe412adce79534e22efe9fb69ee40e2 (patch) | |
tree | 7076c49d4286f8a1733650bd8fbc7161af200d57 /meta/classes/update-alternatives.bbclass | |
parent | 2cf0eadf9f730027833af802d7e6c90b44248f80 (diff) | |
download | poky-b2f192faabe412adce79534e22efe9fb69ee40e2.tar.gz |
Rename /openembedded/ -> /meta/
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@530 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/classes/update-alternatives.bbclass')
-rw-r--r-- | meta/classes/update-alternatives.bbclass | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass new file mode 100644 index 0000000000..6b2b547d5f --- /dev/null +++ b/meta/classes/update-alternatives.bbclass | |||
@@ -0,0 +1,33 @@ | |||
1 | # defaults | ||
2 | ALTERNATIVE_PRIORITY = "10" | ||
3 | ALTERNATIVE_LINK = "${bindir}/${ALTERNATIVE_NAME}" | ||
4 | |||
5 | update_alternatives_postinst() { | ||
6 | update-alternatives --install ${ALTERNATIVE_LINK} ${ALTERNATIVE_NAME} ${ALTERNATIVE_PATH} ${ALTERNATIVE_PRIORITY} | ||
7 | } | ||
8 | |||
9 | update_alternatives_postrm() { | ||
10 | update-alternatives --remove ${ALTERNATIVE_NAME} ${ALTERNATIVE_PATH} | ||
11 | } | ||
12 | |||
13 | python __anonymous() { | ||
14 | if bb.data.getVar('ALTERNATIVE_NAME', d) == None: | ||
15 | raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_NAME" % bb.data.getVar('FILE', d) | ||
16 | if bb.data.getVar('ALTERNATIVE_PATH', d) == None: | ||
17 | raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_PATH" % bb.data.getVar('FILE', d) | ||
18 | } | ||
19 | |||
20 | python populate_packages_prepend () { | ||
21 | pkg = bb.data.getVar('PN', d, 1) | ||
22 | bb.note('adding update-alternatives calls to postinst/postrm for %s' % pkg) | ||
23 | postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) | ||
24 | if not postinst: | ||
25 | postinst = '#!/bin/sh\n' | ||
26 | postinst += bb.data.getVar('update_alternatives_postinst', d, 1) | ||
27 | bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) | ||
28 | postrm = bb.data.getVar('pkg_postrm_%s' % pkg, d, 1) or bb.data.getVar('pkg_postrm', d, 1) | ||
29 | if not postrm: | ||
30 | postrm = '#!/bin/sh\n' | ||
31 | postrm += bb.data.getVar('update_alternatives_postrm', d, 1) | ||
32 | bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d) | ||
33 | } | ||