Handle error during run-agl-postinsts 91/10091/2
authorRonan Le Martret <ronan.lemartret@iot.bzh>
Tue, 4 Jul 2017 08:08:40 +0000 (10:08 +0200)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Fri, 7 Jul 2017 14:25:54 +0000 (14:25 +0000)
 * do not remove post install script if failed

Bug-AGL: SPEC-700

Change-Id: I1b45670ecbe3915a69cfa659031ac877eb794571
Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/10025
Reviewed-by: José Bollo <jobol@nonadev.net>
Tested-by: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org>
ci-image-build: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org>
Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
(cherry picked from commit 0c28379c6d8ab33f3c902b6617503ca634b8c90e)
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/10091

meta-agl/recipes-devtools/run-agl-postinsts/run-agl-postinsts/run-agl-postinsts
meta-app-framework/classes/aglwgt.bbclass

index 7c2effa..87ec0e1 100755 (executable)
@@ -23,10 +23,16 @@ exec_postinst_scriptlets() {
         [ "$POSTINST_LOGGING" = "1" ] && eval echo "Running postinst $i..." $append_log
         if [ -x $i ]; then
             eval sh -c $i $append_log
-            rm $i
+            if [ $? -eq 0 ]; then
+                rm $i
+            else
+                echo "ERROR: postinst $i failed."
+                [ "$POSTINST_LOGGING" = "1" ] && eval echo "ERROR: postinst $i failed." $append_log
+                remove_agl_pi_dir=0
+            fi
         else
-            echo "ERROR: postinst $i failed."
-            [ "$POSTINST_LOGGING" = "1" ] && eval echo "ERROR: postinst $i failed." $append_log
+            echo "ERROR: postinst $i do not exists or do not have execute permission."
+            [ "$POSTINST_LOGGING" = "1" ] && eval echo "ERROR: postinst $i do not exists or do not have execute permission." $append_log
             remove_agl_pi_dir=0
         fi
     done
index afe9a55..37638e6 100644 (file)
@@ -46,11 +46,17 @@ do_aglwgt_deploy() {
     install -d ${D}/${sysconfdir}/agl-postinsts
     cat > ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} <<EOF
 #!/bin/sh -e
+INSTALL_RESULT=0
 for file in ${APP_FILES}; do
     /usr/bin/afm-install install /usr/AGL/apps/\$file
+    if [ $? -ne 0 ]; then
+        echo "Application \$file failed to install"
+        INSTALL_RESULT=1
+    fi
 done
 sync
 ${EXTRA_WGT_POSTINSTALL}
+exit $INSTALL_RESULT
 EOF
     chmod a+x ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}
 }