summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorMichael Lauer <mickey@vanille-media.de>2004-08-05 13:05:40 +0000
committerMichael Lauer <mickey@vanille-media.de>2004-08-05 13:05:40 +0000
commitc4de6d7da36af8588b2a684ab6ff48ef8a385e26 (patch)
treed67524ff57894bab9907ffb4473225061fa84b7f /classes
parentbb13f0dc451e3e82ddbfd288ca08c5c06721ace9 (diff)
remove offline guard for update-alternatives.oeclass. patch courtesy Bruno Randolf
BKrev: 411230a4JKbTN38MGT5Bxq34lIRXbQ
Diffstat (limited to 'classes')
-rw-r--r--classes/update-alternatives.oeclass33
1 files changed, 33 insertions, 0 deletions
diff --git a/classes/update-alternatives.oeclass b/classes/update-alternatives.oeclass
index e69de29bb2..9ac1de1143 100644
--- a/classes/update-alternatives.oeclass
+++ b/classes/update-alternatives.oeclass
@@ -0,0 +1,33 @@
+# 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}
+}
+
+python __anonymous() {
+ if oe.data.getVar('ALTERNATIVE_NAME', d) == None:
+ raise oe.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_NAME" % oe.data.getVar('FILE', d)
+ if oe.data.getVar('ALTERNATIVE_PATH', d) == None:
+ raise oe.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_PATH" % oe.data.getVar('FILE', d)
+}
+
+python populate_packages_prepend () {
+ pkg = oe.data.getVar('PN', d, 1)
+ oe.note('adding update-alternatives calls to postinst/postrm for %s' % pkg)
+ postinst = oe.data.getVar('pkg_postinst_%s' % pkg, d, 1) or oe.data.getVar('pkg_postinst', d, 1)
+ if not postinst:
+ postinst = '#!/bin/sh\n'
+ postinst += oe.data.getVar('update_alternatives_postinst', d, 1)
+ oe.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
+ postrm = oe.data.getVar('pkg_postrm_%s' % pkg, d, 1) or oe.data.getVar('pkg_postrm', d, 1)
+ if not postrm:
+ postrm = '#!/bin/sh\n'
+ postrm += oe.data.getVar('update_alternatives_postrm', d, 1)
+ oe.data.setVar('pkg_postrm_%s' % pkg, postrm, d)
+}