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