From fcb209d3a933c12bf1b8afefb23e747a8bddd790 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 May 2018 16:17:10 +0100 Subject: [PATCH] Tidying --- src/freedombone-addremove | 53 ++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/src/freedombone-addremove b/src/freedombone-addremove index a363af8d..af5c9a60 100755 --- a/src/freedombone-addremove +++ b/src/freedombone-addremove @@ -108,19 +108,17 @@ function show_apps { # shellcheck disable=SC2068 for a in ${APPS_AVAILABLE[@]} do - if [[ $(app_not_on_onion_only "$a") != "0" ]]; then - if [[ ${APPS_INSTALLED[$app_index]} == "0" && "$select_all_apps" != "add-all" ]]; then + if [[ ${APPS_INSTALLED[$app_index]} == "0" && "$select_all_apps" != "add-all" ]]; then + applist="$applist $n $a off" + else + if [[ $(app_expected_to_be_installed "$select_all_apps" "$a") == "0" ]]; then applist="$applist $n $a off" else - if [[ $(app_expected_to_be_installed "$select_all_apps" "$a") == "0" ]]; then - applist="$applist $n $a off" - else - applist="$applist $n $a on" - fi + applist="$applist $n $a on" fi - n=$((n+1)) - app_index=$((app_index+1)) fi + n=$((n+1)) + app_index=$((app_index+1)) done # shellcheck disable=SC2086 @@ -149,19 +147,17 @@ function remove_apps_selected { # shellcheck disable=SC2068 for a in ${APPS_INSTALLED[@]} do - if [[ $(app_not_on_onion_only "$a") != "0" ]]; then - 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)) + 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 - app_index=$((app_index+1)) fi + app_index=$((app_index+1)) done # if no apps to be removed then don't do anything @@ -196,19 +192,18 @@ function install_apps_selected { # shellcheck disable=SC2068 for a in ${APPS_INSTALLED[@]} do - if [[ $(app_not_on_onion_only "$a") != "0" ]]; then - 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)) + 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 - app_index=$((app_index+1)) fi + app_index=$((app_index+1)) + done # if no apps to be installed then don't do anything