]> code.ossystems Code Review - openembedded-core.git/commitdiff
update-alternatives.bbclass: run update-alternatives firstly in postinst script
authorRobert Yang <liezhi.yang@windriver.com>
Wed, 26 Jun 2019 07:40:21 +0000 (15:40 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 27 Jun 2019 11:20:24 +0000 (12:20 +0100)
Recipes like postfix run command newaliases in postinst, but newaliases is
installed as newaliases.postfix, it needs run update-alternatives to update it
to newaliases, so there was an error when installed postinst on target.

Fixed:
$ opkg install postfix
Configuring postfix.
///var/lib/opkg/info/postfix.postinst: line 4: newaliases: command not found

Run update-alternatives firstly will fix the problem.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/update-alternatives.bbclass

index b702e77ee5f1a4209e21a522de67244e89f2ca51..8c2b66e7f15d003b785ceb6e416f1ee3189603a5 100644 (file)
@@ -284,8 +284,11 @@ python populate_packages_updatealternatives () {
 
             bb.note('adding update-alternatives calls to postinst/prerm for %s' % pkg)
             bb.note('%s' % alt_setup_links)
-            postinst = d.getVar('pkg_postinst_%s' % pkg) or '#!/bin/sh\n'
-            postinst += alt_setup_links
+            postinst = d.getVar('pkg_postinst_%s' % pkg)
+            if postinst:
+                postinst = alt_setup_links + postinst
+            else:
+                postinst = '#!/bin/sh\n' + alt_setup_links
             d.setVar('pkg_postinst_%s' % pkg, postinst)
 
             bb.note('%s' % alt_remove_links)