Restore apps in a loop
This commit is contained in:
parent
271368aadd
commit
91dfd1df51
|
@ -906,96 +906,101 @@ function restore_data_from_storage {
|
|||
|
||||
detect_apps
|
||||
|
||||
app_list=()
|
||||
AllStr=$"all"
|
||||
n=1
|
||||
applist="$n $AllStr off"
|
||||
n=$[n+1]
|
||||
|
||||
util_index=0
|
||||
for a in "${utils_installed[@]}"
|
||||
while true
|
||||
do
|
||||
applist="$applist $n $a off"
|
||||
app_name=${utils_installed[util_index]}
|
||||
|
||||
app_list=()
|
||||
AllStr=$"all"
|
||||
n=1
|
||||
applist="$n $AllStr off"
|
||||
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"
|
||||
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
|
||||
ExitStr=$"Exit"
|
||||
applist="$applist $n $ExitStr on"
|
||||
n=$[n+1]
|
||||
app_name=${APPS_INSTALLED_NAMES[app_index]}
|
||||
app_index=$[app_index+1]
|
||||
app_list+=("$app_name")
|
||||
done
|
||||
ExitStr=$"Exit"
|
||||
applist="$applist $n $ExitStr on"
|
||||
n=$[n+1]
|
||||
|
||||
choices=$(dialog --stdout --backtitle $"Freedombone" \
|
||||
--title $"Restore apps" \
|
||||
--radiolist $'Choose:' \
|
||||
30 40 20 $applist)
|
||||
choices=$(dialog --stdout --backtitle $"Freedombone" \
|
||||
--title $"Restore apps" \
|
||||
--radiolist $'Choose:' \
|
||||
30 40 20 $applist)
|
||||
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) return;;
|
||||
255) return;;
|
||||
esac
|
||||
app_name=$(cat $data)
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) return;;
|
||||
255) return;;
|
||||
esac
|
||||
app_name=$(cat $data)
|
||||
|
||||
# exit
|
||||
if [[ $app_name == "$ExitStr" ]]; then
|
||||
return
|
||||
fi
|
||||
# exit
|
||||
if [[ $app_name == "$ExitStr" ]]; then
|
||||
break
|
||||
fi
|
||||
|
||||
clear
|
||||
clear
|
||||
|
||||
# Restore all
|
||||
if [[ $app_name == "$AllStr" ]]; then
|
||||
$restore_command
|
||||
retcode="$?"
|
||||
if [[ "$retcode" != "0" ]]; then
|
||||
if [[ "$1" == "local" ]]; then
|
||||
dialog --title $"Restore all apps from USB" \
|
||||
--msgbox $"Restore failed with code $retcode" 6 60
|
||||
else
|
||||
dialog --title $"Restore all apps from $1" \
|
||||
--msgbox $"Restore failed with code $retcode" 6 60
|
||||
fi
|
||||
break
|
||||
fi
|
||||
|
||||
# Restore all
|
||||
if [[ $app_name == "$AllStr" ]]; then
|
||||
$restore_command
|
||||
retcode="$?"
|
||||
if [[ "$retcode" != "0" ]]; then
|
||||
if [[ "$1" == "local" ]]; then
|
||||
dialog --title $"Restore all apps from USB" \
|
||||
--msgbox $"Restore failed with code $retcode" 6 60
|
||||
--msgbox $"Restore complete" 6 40
|
||||
else
|
||||
dialog --title $"Restore all apps from $1" \
|
||||
--msgbox $"Restore failed with code $retcode" 6 60
|
||||
--msgbox $"Restore complete" 6 40
|
||||
fi
|
||||
break
|
||||
fi
|
||||
|
||||
# Restore an app
|
||||
$restore_command "${app_name}"
|
||||
retcode="$?"
|
||||
if [[ "$retcode" != "0" ]]; then
|
||||
dialog --title $"Restore apps from USB" \
|
||||
--msgbox $"Restore of ${app_name} failed with code $retcode" 6 60
|
||||
return
|
||||
fi
|
||||
|
||||
# finished
|
||||
if [[ "$1" == "local" ]]; then
|
||||
dialog --title $"Restore all apps from USB" \
|
||||
dialog --title $"Restore apps from USB" \
|
||||
--msgbox $"Restore complete" 6 40
|
||||
else
|
||||
dialog --title $"Restore all apps from $1" \
|
||||
dialog --title $"Restore apps from $1" \
|
||||
--msgbox $"Restore complete" 6 40
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
# Restore an app
|
||||
$restore_command "${app_name}"
|
||||
retcode="$?"
|
||||
if [[ "$retcode" != "0" ]]; then
|
||||
dialog --title $"Restore apps from USB" \
|
||||
--msgbox $"Restore of ${app_name} failed with code $retcode" 6 60
|
||||
return
|
||||
fi
|
||||
|
||||
# finished
|
||||
if [[ "$1" == "local" ]]; then
|
||||
dialog --title $"Restore apps from USB" \
|
||||
--msgbox $"Restore complete" 6 40
|
||||
else
|
||||
dialog --title $"Restore apps from $1" \
|
||||
--msgbox $"Restore complete" 6 40
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function restore_data {
|
||||
|
|
Loading…
Reference in New Issue