Browse Source

Get the restore app name

Bob Mottram 8 years ago
parent
commit
a1fcbfe42c
1 changed files with 17 additions and 3 deletions
  1. 17
    3
      src/freedombone-controlpanel

+ 17
- 3
src/freedombone-controlpanel View File

912
     while true
912
     while true
913
     do
913
     do
914
 
914
 
915
+        app_list=()
915
         n=1
916
         n=1
916
         applist="$n $AllStr off"
917
         applist="$n $AllStr off"
917
         n=$[n+1]
918
         n=$[n+1]
919
+        app_list+=("$AllStr")
918
 
920
 
921
+        util_index=0
919
         for a in "${utils_installed[@]}"
922
         for a in "${utils_installed[@]}"
920
         do
923
         do
921
             applist="$applist $n $a off"
924
             applist="$applist $n $a off"
925
+            app_name=${utils_installed[util_index]}
922
             n=$[n+1]
926
             n=$[n+1]
927
+            util_index=$[util_index+1]
928
+            app_list+=("$app_name")
923
         done
929
         done
924
 
930
 
931
+        app_index=0
925
         for a in "${APPS_INSTALLED_NAMES[@]}"
932
         for a in "${APPS_INSTALLED_NAMES[@]}"
926
         do
933
         do
927
             applist="$applist $n $a off"
934
             applist="$applist $n $a off"
928
             n=$[n+1]
935
             n=$[n+1]
936
+            app_name=${APPS_INSTALLED_NAMES[app_index]}
937
+            app_index=$[app_index+1]
938
+            app_list+=("$app_name")
929
         done
939
         done
930
         applist="$applist $n $ExitStr on"
940
         applist="$applist $n $ExitStr on"
931
         n=$[n+1]
941
         n=$[n+1]
942
+        app_list+=("$ExitStr")
932
 
943
 
933
         choices=$(dialog --stdout --backtitle $"Freedombone" \
944
         choices=$(dialog --stdout --backtitle $"Freedombone" \
934
                          --title $"Restore apps" \
945
                          --title $"Restore apps" \
937
 
948
 
938
         sel=$?
949
         sel=$?
939
         case $sel in
950
         case $sel in
940
-            1) break;;
941
-            255) break;;
951
+            1) return;;
952
+            255) return;;
942
         esac
953
         esac
943
-        app_name=$(cat $data)
954
+        selected_index=$(cat $data)
955
+        selected_index=$[selected_index-1]
956
+        app_name=${app_list[$selected_index]}
944
 
957
 
945
         # exit
958
         # exit
946
         if [[ "$app_name" == "$ExitStr" ]]; then
959
         if [[ "$app_name" == "$ExitStr" ]]; then
948
         fi
961
         fi
949
 
962
 
950
         clear
963
         clear
964
+        echo $"Selected $app_name"
951
 
965
 
952
         # Restore all
966
         # Restore all
953
         if [[ "$app_name" == "$AllStr" ]]; then
967
         if [[ "$app_name" == "$AllStr" ]]; then