if [[ ${APPS_INSTALLED[$app_index]} == "1" ]]; then
if [[ ${APPS_CHOSEN[$app_index]} == "0" ]]; then
if [ ${n} -gt 0 ]; then
removals="$removals $APPS_AVAILABLE[$app_index]"
else
removals="$APPS_AVAILABLE[$app_index]"
fi
n=$[n+1]
fi
fi
app_index=$[app_index+1]
done
# if no apps to be removed then don't do anything
if [ ${n} -eq 0 ]; then
return
fi
# ask for confirmation
dialog --title $"Remove applications" \
--backtitle $"Freedombone" \
--defaultno \
--yesno $"\nYou have chosen to remove $n apps.\n\n $removals\n\nIf you choose 'yes' then this will remove both the applications and their data/messages. If you don't have a backup then you will not be able to recover the data for these applications.\n\nAre you sure that you wish to continue?" 15 60
sel=$?
case $sel in
1) return;;
255) return;;
esac
# remove the apps
read_configuration
remove_apps
}
function install_apps_interactive {
# which apps need to be installed?
installs=""
app_index=0
n=0
for a in "${APPS_INSTALLED[@]}"
do
if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
if [ ${n} -gt 0 ]; then
installs="$installs $APPS_AVAILABLE[$app_index]"
else
installs="$APPS_AVAILABLE[$app_index]"
fi
n=$[n+1]
fi
fi
app_index=$[app_index+1]
done
# if no apps to be installed then don't do anything
if [ ${n} -eq 0 ]; then
return
fi
# ask for confirmation
dialog --title $"Remove applications" \
--backtitle $"Freedombone" \
--defaultno \
--yesno $"\nYou have chosen to install $n apps.\n\n $installs\n\nIf you choose 'yes' then these will now be installed.\n\nAre you sure that you wish to continue?" 15 60