Restore using radiolist

This commit is contained in:
Bob Mottram 2016-10-24 09:47:17 +01:00
parent 0b18eb1e4f
commit d527e86c84
1 changed files with 49 additions and 65 deletions

View File

@ -937,28 +937,24 @@ function restore_data_from_storage {
choices=$(dialog --stdout --backtitle $"Freedombone" \
--title $"Restore apps" \
--checklist $'Choose:' \
--radiolist $'Choose:' \
30 40 20 $applist)
if [ $? -eq 0 ]; then
clear
sel=$?
case $sel in
1) return;;
255) return;;
esac
app_name=$(cat $data)
# Test for exit
for choice in $choices
do
app_index=$[choice-1]
app_name=${app_list[app_index]}
# exit
if [[ $app_name == "$ExitStr" ]]; then
return
fi
done
# Test for restoring all apps
for choice in $choices
do
app_index=$[choice-2]
app_name=${app_list[app_index]}
# Restore all
if [[ $app_name == "$AllStr" ]]; then
clear
$restore_command
retcode="$?"
if [[ "$retcode" != "0" ]]; then
@ -981,14 +977,8 @@ function restore_data_from_storage {
fi
return
fi
done
ctr=0
for choice in $choices
do
app_index=$[choice-2]
app_name=${app_list[app_index]}
if [ ${#app_name} -gt 0 ]; then
# Restore an app
$restore_command "${app_name}"
retcode="$?"
if [[ "$retcode" != "0" ]]; then
@ -996,10 +986,8 @@ function restore_data_from_storage {
--msgbox $"Restore of ${app_name} failed with code $retcode" 6 60
return
fi
fi
ctr=$((ctr + 1))
done
if [ $ctr -gt 0 ]; then
# finished
if [[ "$1" == "local" ]]; then
dialog --title $"Restore apps from USB" \
--msgbox $"Restore complete" 6 40
@ -1007,10 +995,6 @@ function restore_data_from_storage {
dialog --title $"Restore apps from $1" \
--msgbox $"Restore complete" 6 40
fi
return
fi
fi
any_key
}
function restore_data {