From 006e58e1debf6cdcaf66df6f56d028731034cfb7 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@robotics.uk.to>
Date: Fri, 30 Sep 2016 17:39:02 +0100
Subject: [PATCH] Try apps list first

---
 src/freedombone-utils-selector | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/freedombone-utils-selector b/src/freedombone-utils-selector
index 01eead40b..a25f719e6 100755
--- a/src/freedombone-utils-selector
+++ b/src/freedombone-utils-selector
@@ -59,13 +59,9 @@ function item_in_array {
 
 function app_is_installed {
     app_name="$1"
-    if [ ! -f $COMPLETION_FILE ]; then
-        echo "0"
-        return
-    fi
-
-    if [ -f /usr/share/${PROJECT_NAME}/installed.txt ]; then
-        if ! grep -Fxq "install_${app_name}" /usr/share/${PROJECT_NAME}/installed.txt; then
+    INSTALLED_APPS_LIST=/usr/share/${PROJECT_NAME}/installed.txt
+    if [ -f $INSTALLED_APPS_LIST ]; then
+        if ! grep -Fxq "install_${app_name}" $INSTALLED_APPS_LIST; then
             echo "0"
         else
             echo "1"
@@ -73,6 +69,11 @@ function app_is_installed {
         return
     fi
 
+    if [ ! -f $COMPLETION_FILE ]; then
+        echo "0"
+        return
+    fi
+
     if ! grep -Fxq "install_${app_name}" $COMPLETION_FILE; then
         echo "0"
     else
-- 
GitLab