From a1fcbfe42c6b32c0383b169e4af24e146d1b8724 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 24 Oct 2016 18:20:17 +0100 Subject: [PATCH] Get the restore app name --- src/freedombone-controlpanel | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index faf1339c..14ed2cc2 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -912,23 +912,34 @@ function restore_data_from_storage { while true do + app_list=() n=1 applist="$n $AllStr off" n=$[n+1] + app_list+=("$AllStr") + util_index=0 for a in "${utils_installed[@]}" do applist="$applist $n $a off" + app_name=${utils_installed[util_index]} n=$[n+1] + util_index=$[util_index+1] + app_list+=("$app_name") done + app_index=0 for a in "${APPS_INSTALLED_NAMES[@]}" do applist="$applist $n $a off" n=$[n+1] + app_name=${APPS_INSTALLED_NAMES[app_index]} + app_index=$[app_index+1] + app_list+=("$app_name") done applist="$applist $n $ExitStr on" n=$[n+1] + app_list+=("$ExitStr") choices=$(dialog --stdout --backtitle $"Freedombone" \ --title $"Restore apps" \ @@ -937,10 +948,12 @@ function restore_data_from_storage { sel=$? case $sel in - 1) break;; - 255) break;; + 1) return;; + 255) return;; esac - app_name=$(cat $data) + selected_index=$(cat $data) + selected_index=$[selected_index-1] + app_name=${app_list[$selected_index]} # exit if [[ "$app_name" == "$ExitStr" ]]; then @@ -948,6 +961,7 @@ function restore_data_from_storage { fi clear + echo $"Selected $app_name" # Restore all if [[ "$app_name" == "$AllStr" ]]; then