]> code.ossystems Code Review - openembedded-core.git/commitdiff
run-postinsts: fix issue with checking IMAGE_FEATURES
authorLaurentiu Palcu <laurentiu.palcu@intel.com>
Thu, 27 Mar 2014 12:43:57 +0000 (14:43 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 27 Mar 2014 15:44:16 +0000 (15:44 +0000)
The old implementation was wrong. It was not very generic and it checked
IMAGE_FEATURES while building the recipe, which led to various issues
with the generation of the final script. That is, the run-postinsts
script was generated once, while building the package for the first
time. Hence, any other changes to IMAGE_FEATURES, like removing/adding
'package-management' did not reflect in the final script.

This commit makes run-postinsts script autodetect the backend used for
creating the image, making it generic.

[YOCTO #5666]
[YOCTO #5972]

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb

index 08cfa9e59f9888bf30850e9d0b81139f116f503d..f547a7b7bd389aee119d160ebee75481616bedda 100755 (executable)
@@ -8,9 +8,29 @@
 # The following script will run all the scriptlets found in #SYSCONFDIR#/deb-postinsts,
 # #SYSCONFDIR#/ipk-postinsts or #SYSCONFDIR#/rpm-posinsts.
 
-pm=#IMAGE_PKGTYPE#
-pm_installed=#PM_INSTALLED#
-pi_dir=#SYSCONFDIR#/${pm}-postinsts
+# the order of this list is important, do not change!
+backend_list="rpm deb ipk"
+
+pm_installed=false
+
+for pm in $backend_list; do
+       pi_dir="#SYSCONFDIR#/$pm-postinsts"
+
+       [ -d $pi_dir ] && break
+
+       case $pm in
+               "deb")
+                       if [ -s "/var/lib/dpkg/status" ]; then
+                               pm_installed=true
+                               break
+                       fi
+                       ;;
+
+               "ipk")
+                       pm_installed=true
+                       ;;
+       esac
+done
 
 remove_rcsd_link () {
        if [ -n "`which update-rc.d`" ]; then
@@ -56,10 +76,6 @@ if $pm_installed; then
                "deb")
                        eval dpkg --configure -a $append_log
                        ;;
-
-               "rpm")
-                       exec_postinst_scriptlets
-                       ;;
        esac
 else
        exec_postinst_scriptlets
index e990c670c0fa7d13cfbc5638c09a4874966cefa9..64f85c262df3ad3b55cacc6f47b3bb97091d04ba 100644 (file)
@@ -37,8 +37,6 @@ do_install() {
        sed -i -e 's:#SYSCONFDIR#:${sysconfdir}:g' \
                -e 's:#SBINDIR#:${sbindir}:g' \
                -e 's:#BASE_BINDIR#:${base_bindir}:g' \
-               -e 's:#IMAGE_PKGTYPE#:${IMAGE_PKGTYPE}:g' \
-               -e 's:#PM_INSTALLED#:${@base_contains("IMAGE_FEATURES", "package-management", "true", "false", d)}:g' \
                ${D}${sbindir}/run-postinsts \
                ${D}${systemd_unitdir}/system/run-postinsts.service
 }