From d925c4f00dd07aeeabd5aa5ed07898fff6a97a97 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@robotics.uk.to>
Date: Wed, 19 Oct 2016 10:50:22 +0100
Subject: [PATCH] Check that all chosen apps actually do get installed

---
 src/freedombone-addremove      | 4 ++++
 src/freedombone-utils-selector | 4 ++++
 src/freedombone-utils-setup    | 7 +++++++
 3 files changed, 15 insertions(+)

diff --git a/src/freedombone-addremove b/src/freedombone-addremove
index 6a7323ff9..ace930ad1 100755
--- a/src/freedombone-addremove
+++ b/src/freedombone-addremove
@@ -174,6 +174,10 @@ function install_apps_selected {
     # install the apps
     read_configuration
     install_apps interactive
+    if [ ! $APP_INSTALLED_SUCCESS ]; then
+        echo $'One or more apps failed to install'
+        exit 357223
+    fi
 }
 
 if [[ $1 == "test"* ]]; then
diff --git a/src/freedombone-utils-selector b/src/freedombone-utils-selector
index 39f5dd531..4542ba3ef 100755
--- a/src/freedombone-utils-selector
+++ b/src/freedombone-utils-selector
@@ -426,6 +426,8 @@ function install_apps_interactive {
 function install_apps {
     is_interactive=$1
 
+    APP_INSTALLED_SUCCESS=1
+
     # interactive install configuration for each app
     if [ ${is_interactive} ]; then
         install_apps_interactive
@@ -461,6 +463,7 @@ function install_apps {
                             install_completed ${a}
                             echo $"${a} was installed from interactive"
                         else
+                            APP_INSTALLED_SUCCESS=
                             echo $"${a} was not installed from interactive"
                         fi
                     fi
@@ -485,6 +488,7 @@ function install_apps {
                                 install_completed ${a}
                                 echo $"${a} was installed"
                             else
+                                APP_INSTALLED_SUCCESS=
                                 echo $"${a} was not installed"
                             fi
                         fi
diff --git a/src/freedombone-utils-setup b/src/freedombone-utils-setup
index 83f792189..552eeda46 100755
--- a/src/freedombone-utils-setup
+++ b/src/freedombone-utils-setup
@@ -545,11 +545,18 @@ function setup_apps {
 
     if [[ $is_interactive == "menuconfig"* ]]; then
         ${PROJECT_NAME}-addremove add-all
+        if [ ! "$?" = "0" ]; then
+            exit 72524
+        fi
     fi
 
     if [[ $is_interactive == "noninteractive" || $is_interactive == "headless" ]]; then
         function_check install_apps
         install_apps
+        if [ ! $APP_INSTALLED_SUCCESS ]; then
+            echo $'One or more apps failed to install'
+            exit 368224
+        fi
     fi
 }
 
-- 
GitLab