| 
				
			 | 
			
			
				@@ -0,0 +1,240 @@ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1
			 | 
			
			
				+#!/bin/bash 
			 | 
		
	
		
			
			| 
				
			 | 
			
				2
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3
			 | 
			
			
				+# .---.                  .              . 
			 | 
		
	
		
			
			| 
				
			 | 
			
				4
			 | 
			
			
				+# |                      |              | 
			 | 
		
	
		
			
			| 
				
			 | 
			
				5
			 | 
			
			
				+# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-. 
			 | 
		
	
		
			
			| 
				
			 | 
			
				6
			 | 
			
			
				+# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7
			 | 
			
			
				+# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				8
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				9
			 | 
			
			
				+#                    Freedom in the Cloud 
			 | 
		
	
		
			
			| 
				
			 | 
			
				10
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				11
			 | 
			
			
				+# Add or remove apps 
			 | 
		
	
		
			
			| 
				
			 | 
			
				12
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				13
			 | 
			
			
				+# License 
			 | 
		
	
		
			
			| 
				
			 | 
			
				14
			 | 
			
			
				+# ======= 
			 | 
		
	
		
			
			| 
				
			 | 
			
				15
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				16
			 | 
			
			
				+# Copyright (C) 2015-2016 Bob Mottram <bob@robotics.uk.to> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				17
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				18
			 | 
			
			
				+# This program is free software: you can redistribute it and/or modify 
			 | 
		
	
		
			
			| 
				
			 | 
			
				19
			 | 
			
			
				+# it under the terms of the GNU Affero General Public License as published by 
			 | 
		
	
		
			
			| 
				
			 | 
			
				20
			 | 
			
			
				+# the Free Software Foundation, either version 3 of the License, or 
			 | 
		
	
		
			
			| 
				
			 | 
			
				21
			 | 
			
			
				+# (at your option) any later version. 
			 | 
		
	
		
			
			| 
				
			 | 
			
				22
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				23
			 | 
			
			
				+# This program is distributed in the hope that it will be useful, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				24
			 | 
			
			
				+# but WITHOUT ANY WARRANTY; without even the implied warranty of 
			 | 
		
	
		
			
			| 
				
			 | 
			
				25
			 | 
			
			
				+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
			 | 
		
	
		
			
			| 
				
			 | 
			
				26
			 | 
			
			
				+# GNU Affero General Public License for more details. 
			 | 
		
	
		
			
			| 
				
			 | 
			
				27
			 | 
			
			
				+# 
			 | 
		
	
		
			
			| 
				
			 | 
			
				28
			 | 
			
			
				+# You should have received a copy of the GNU Affero General Public License 
			 | 
		
	
		
			
			| 
				
			 | 
			
				29
			 | 
			
			
				+# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
			 | 
		
	
		
			
			| 
				
			 | 
			
				30
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				31
			 | 
			
			
				+PROJECT_NAME='freedombone' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				32
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				33
			 | 
			
			
				+export TEXTDOMAIN=${PROJECT_NAME}-selector 
			 | 
		
	
		
			
			| 
				
			 | 
			
				34
			 | 
			
			
				+export TEXTDOMAINDIR="/usr/share/locale" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				35
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				36
			 | 
			
			
				+PROJECT_INSTALL_DIR=/usr/local/bin 
			 | 
		
	
		
			
			| 
				
			 | 
			
				37
			 | 
			
			
				+if [ -f /usr/bin/${PROJECT_NAME} ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				38
			 | 
			
			
				+	PROJECT_INSTALL_DIR=/usr/bin 
			 | 
		
	
		
			
			| 
				
			 | 
			
				39
			 | 
			
			
				+fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				40
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				41
			 | 
			
			
				+source $PROJECT_INSTALL_DIR/${PROJECT_NAME}-vars 
			 | 
		
	
		
			
			| 
				
			 | 
			
				42
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				43
			 | 
			
			
				+COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt 
			 | 
		
	
		
			
			| 
				
			 | 
			
				44
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				45
			 | 
			
			
				+# Array containing names of available apps 
			 | 
		
	
		
			
			| 
				
			 | 
			
				46
			 | 
			
			
				+APPS_AVAILABLE=() 
			 | 
		
	
		
			
			| 
				
			 | 
			
				47
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				48
			 | 
			
			
				+# Array containing 1 or 0 indicating installed apps 
			 | 
		
	
		
			
			| 
				
			 | 
			
				49
			 | 
			
			
				+APPS_INSTALLED=() 
			 | 
		
	
		
			
			| 
				
			 | 
			
				50
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				51
			 | 
			
			
				+# Apps selected with checklist 
			 | 
		
	
		
			
			| 
				
			 | 
			
				52
			 | 
			
			
				+APPS_CHOSEN=() 
			 | 
		
	
		
			
			| 
				
			 | 
			
				53
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				54
			 | 
			
			
				+function item_in_array { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				55
			 | 
			
			
				+	local e 
			 | 
		
	
		
			
			| 
				
			 | 
			
				56
			 | 
			
			
				+	for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done 
			 | 
		
	
		
			
			| 
				
			 | 
			
				57
			 | 
			
			
				+	return 1 
			 | 
		
	
		
			
			| 
				
			 | 
			
				58
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				59
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				60
			 | 
			
			
				+function app_is_installed { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				61
			 | 
			
			
				+	app_name="$1" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				62
			 | 
			
			
				+	if ! grep -Fxq "install_${app_name}" $COMPLETION_FILE; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				63
			 | 
			
			
				+		echo "0" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				64
			 | 
			
			
				+	else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				65
			 | 
			
			
				+		echo "1" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				66
			 | 
			
			
				+	fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				67
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				68
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				69
			 | 
			
			
				+function get_apps_installed { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				70
			 | 
			
			
				+	for a in "${APPS_AVAILABLE[@]}" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				71
			 | 
			
			
				+	do 
			 | 
		
	
		
			
			| 
				
			 | 
			
				72
			 | 
			
			
				+		APPS_INSTALLED+=("$(app_is_installed $a)") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				73
			 | 
			
			
				+	done 
			 | 
		
	
		
			
			| 
				
			 | 
			
				74
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				75
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				76
			 | 
			
			
				+function detect_apps { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				77
			 | 
			
			
				+	FILES=$PROJECT_INSTALL_DIR/${PROJECT_NAME}-app-* 
			 | 
		
	
		
			
			| 
				
			 | 
			
				78
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				79
			 | 
			
			
				+	# for all the app scripts 
			 | 
		
	
		
			
			| 
				
			 | 
			
				80
			 | 
			
			
				+	for filename in $FILES 
			 | 
		
	
		
			
			| 
				
			 | 
			
				81
			 | 
			
			
				+	do 
			 | 
		
	
		
			
			| 
				
			 | 
			
				82
			 | 
			
			
				+		app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}') 
			 | 
		
	
		
			
			| 
				
			 | 
			
				83
			 | 
			
			
				+		if [[ $(item_in_array ${app_name} ${APPS_AVAILABLE[@]}) != 0 ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				84
			 | 
			
			
				+			APPS_AVAILABLE+=("${app_name}") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				85
			 | 
			
			
				+			APPS_CHOSEN+=("0") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				86
			 | 
			
			
				+		fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				87
			 | 
			
			
				+	done 
			 | 
		
	
		
			
			| 
				
			 | 
			
				88
			 | 
			
			
				+	get_apps_installed 
			 | 
		
	
		
			
			| 
				
			 | 
			
				89
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				90
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				91
			 | 
			
			
				+function show_apps { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				92
			 | 
			
			
				+	applist="" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				93
			 | 
			
			
				+	n=1 
			 | 
		
	
		
			
			| 
				
			 | 
			
				94
			 | 
			
			
				+	app_index=0 
			 | 
		
	
		
			
			| 
				
			 | 
			
				95
			 | 
			
			
				+	for a in "${APPS_AVAILABLE[@]}" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				96
			 | 
			
			
				+	do 
			 | 
		
	
		
			
			| 
				
			 | 
			
				97
			 | 
			
			
				+		if [[ $APPS_INSTALLED[$app_index] == "0" ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				98
			 | 
			
			
				+			applist="$applist $n $a off" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				99
			 | 
			
			
				+		else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				100
			 | 
			
			
				+			applist="$applist $n $a on" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				101
			 | 
			
			
				+		fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				102
			 | 
			
			
				+		n=$[n+1] 
			 | 
		
	
		
			
			| 
				
			 | 
			
				103
			 | 
			
			
				+		app_index=$[app_index+1] 
			 | 
		
	
		
			
			| 
				
			 | 
			
				104
			 | 
			
			
				+	done 
			 | 
		
	
		
			
			| 
				
			 | 
			
				105
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				106
			 | 
			
			
				+	choices=$(dialog --stdout --backtitle $"Freedombone" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				107
			 | 
			
			
				+					 --title $"Installed applications" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				108
			 | 
			
			
				+					 --checklist $'Choose:' \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				109
			 | 
			
			
				+					 80 40 20 $applist) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				110
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				111
			 | 
			
			
				+	if [ $? -eq 0 ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				112
			 | 
			
			
				+		for choice in $choices 
			 | 
		
	
		
			
			| 
				
			 | 
			
				113
			 | 
			
			
				+		do 
			 | 
		
	
		
			
			| 
				
			 | 
			
				114
			 | 
			
			
				+			app_index = $[choice-1] 
			 | 
		
	
		
			
			| 
				
			 | 
			
				115
			 | 
			
			
				+			APPS_CHOSEN[$app_index]="1" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				116
			 | 
			
			
				+		done 
			 | 
		
	
		
			
			| 
				
			 | 
			
				117
			 | 
			
			
				+	else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				118
			 | 
			
			
				+		exit 0 
			 | 
		
	
		
			
			| 
				
			 | 
			
				119
			 | 
			
			
				+	fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				120
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				121
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				122
			 | 
			
			
				+function remove_apps { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				123
			 | 
			
			
				+	# which apps need to be removed? 
			 | 
		
	
		
			
			| 
				
			 | 
			
				124
			 | 
			
			
				+	removals="" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				125
			 | 
			
			
				+	app_index=0 
			 | 
		
	
		
			
			| 
				
			 | 
			
				126
			 | 
			
			
				+	n=0 
			 | 
		
	
		
			
			| 
				
			 | 
			
				127
			 | 
			
			
				+	for a in "${APPS_INSTALLED[@]}" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				128
			 | 
			
			
				+	do 
			 | 
		
	
		
			
			| 
				
			 | 
			
				129
			 | 
			
			
				+		if [[ $APPS_INSTALLED[$app_index] == "1" ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				130
			 | 
			
			
				+			if [[ $APPS_CHOSEN[$app_index] == "0" ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				131
			 | 
			
			
				+				if [ ${n} -gt 0 ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				132
			 | 
			
			
				+					removals="$removals $APPS_AVAILABLE[$app_index]" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				133
			 | 
			
			
				+				else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				134
			 | 
			
			
				+					removals="$APPS_AVAILABLE[$app_index]" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				135
			 | 
			
			
				+				fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				136
			 | 
			
			
				+				n=$[n+1] 
			 | 
		
	
		
			
			| 
				
			 | 
			
				137
			 | 
			
			
				+			fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				138
			 | 
			
			
				+		fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				139
			 | 
			
			
				+		app_index=$[app_index+1] 
			 | 
		
	
		
			
			| 
				
			 | 
			
				140
			 | 
			
			
				+	done 
			 | 
		
	
		
			
			| 
				
			 | 
			
				141
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				142
			 | 
			
			
				+	# if no apps to be removed then don't do anything 
			 | 
		
	
		
			
			| 
				
			 | 
			
				143
			 | 
			
			
				+	if [ ${n} -eq 0 ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				144
			 | 
			
			
				+		return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				145
			 | 
			
			
				+	fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				146
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				147
			 | 
			
			
				+	# ask for confirmation 
			 | 
		
	
		
			
			| 
				
			 | 
			
				148
			 | 
			
			
				+	dialog --title $"Remove applications" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				149
			 | 
			
			
				+		   --backtitle $"Freedombone" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				150
			 | 
			
			
				+		   --defaultno \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				151
			 | 
			
			
				+		   --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 
			 | 
		
	
		
			
			| 
				
			 | 
			
				152
			 | 
			
			
				+	sel=$? 
			 | 
		
	
		
			
			| 
				
			 | 
			
				153
			 | 
			
			
				+	case $sel in 
			 | 
		
	
		
			
			| 
				
			 | 
			
				154
			 | 
			
			
				+		1) return;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				155
			 | 
			
			
				+		255) return;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				156
			 | 
			
			
				+	esac 
			 | 
		
	
		
			
			| 
				
			 | 
			
				157
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				158
			 | 
			
			
				+	# remove the apps 
			 | 
		
	
		
			
			| 
				
			 | 
			
				159
			 | 
			
			
				+	read_configuration 
			 | 
		
	
		
			
			| 
				
			 | 
			
				160
			 | 
			
			
				+	for a in "${APPS_AVAILABLE[@]}" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				161
			 | 
			
			
				+	do 
			 | 
		
	
		
			
			| 
				
			 | 
			
				162
			 | 
			
			
				+		if [[ $APPS_INSTALLED[$app_index] == "1" ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				163
			 | 
			
			
				+			if [[ $APPS_CHOSEN[$app_index] == "0" ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				164
			 | 
			
			
				+				echo $"Removing application: ${a}" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				165
			 | 
			
			
				+				remove_${a} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				166
			 | 
			
			
				+				echo $"${a} was removed" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				167
			 | 
			
			
				+			fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				168
			 | 
			
			
				+		fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				169
			 | 
			
			
				+		app_index=$[app_index+1] 
			 | 
		
	
		
			
			| 
				
			 | 
			
				170
			 | 
			
			
				+	done 
			 | 
		
	
		
			
			| 
				
			 | 
			
				171
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				172
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				173
			 | 
			
			
				+function install_apps { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				174
			 | 
			
			
				+	# which apps need to be installed? 
			 | 
		
	
		
			
			| 
				
			 | 
			
				175
			 | 
			
			
				+	installs="" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				176
			 | 
			
			
				+	app_index=0 
			 | 
		
	
		
			
			| 
				
			 | 
			
				177
			 | 
			
			
				+	n=0 
			 | 
		
	
		
			
			| 
				
			 | 
			
				178
			 | 
			
			
				+	for a in "${APPS_INSTALLED[@]}" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				179
			 | 
			
			
				+	do 
			 | 
		
	
		
			
			| 
				
			 | 
			
				180
			 | 
			
			
				+		if [[ $APPS_INSTALLED[$app_index] == "0" ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				181
			 | 
			
			
				+			if [[ $APPS_CHOSEN[$app_index] == "1" ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				182
			 | 
			
			
				+				if [ ${n} -gt 0 ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				183
			 | 
			
			
				+					installs="$installs $APPS_AVAILABLE[$app_index]" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				184
			 | 
			
			
				+				else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				185
			 | 
			
			
				+					installs="$APPS_AVAILABLE[$app_index]" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				186
			 | 
			
			
				+				fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				187
			 | 
			
			
				+				n=$[n+1] 
			 | 
		
	
		
			
			| 
				
			 | 
			
				188
			 | 
			
			
				+			fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				189
			 | 
			
			
				+		fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				190
			 | 
			
			
				+		app_index=$[app_index+1] 
			 | 
		
	
		
			
			| 
				
			 | 
			
				191
			 | 
			
			
				+	done 
			 | 
		
	
		
			
			| 
				
			 | 
			
				192
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				193
			 | 
			
			
				+	# if no apps to be installed then don't do anything 
			 | 
		
	
		
			
			| 
				
			 | 
			
				194
			 | 
			
			
				+	if [ ${n} -eq 0 ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				195
			 | 
			
			
				+		return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				196
			 | 
			
			
				+	fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				197
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				198
			 | 
			
			
				+	# ask for confirmation 
			 | 
		
	
		
			
			| 
				
			 | 
			
				199
			 | 
			
			
				+	dialog --title $"Remove applications" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				200
			 | 
			
			
				+		   --backtitle $"Freedombone" \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				201
			 | 
			
			
				+		   --defaultno \ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				202
			 | 
			
			
				+		   --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 
			 | 
		
	
		
			
			| 
				
			 | 
			
				203
			 | 
			
			
				+	sel=$? 
			 | 
		
	
		
			
			| 
				
			 | 
			
				204
			 | 
			
			
				+	case $sel in 
			 | 
		
	
		
			
			| 
				
			 | 
			
				205
			 | 
			
			
				+		1) return;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				206
			 | 
			
			
				+		255) return;; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				207
			 | 
			
			
				+	esac 
			 | 
		
	
		
			
			| 
				
			 | 
			
				208
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				209
			 | 
			
			
				+	# install the apps 
			 | 
		
	
		
			
			| 
				
			 | 
			
				210
			 | 
			
			
				+	read_configuration 
			 | 
		
	
		
			
			| 
				
			 | 
			
				211
			 | 
			
			
				+	for a in "${APPS_AVAILABLE[@]}" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				212
			 | 
			
			
				+	do 
			 | 
		
	
		
			
			| 
				
			 | 
			
				213
			 | 
			
			
				+		if [[ $APPS_INSTALLED[$app_index] == "0" ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				214
			 | 
			
			
				+			if [[ $APPS_CHOSEN[$app_index] == "1" ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				215
			 | 
			
			
				+				echo $"Installing application: ${a}" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				216
			 | 
			
			
				+				install_${a} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				217
			 | 
			
			
				+				echo $"${a} was installed" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				218
			 | 
			
			
				+			fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				219
			 | 
			
			
				+		fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				220
			 | 
			
			
				+		app_index=$[app_index+1] 
			 | 
		
	
		
			
			| 
				
			 | 
			
				221
			 | 
			
			
				+	done 
			 | 
		
	
		
			
			| 
				
			 | 
			
				222
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				223
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				224
			 | 
			
			
				+${PROJECT_NAME}-tests 
			 | 
		
	
		
			
			| 
				
			 | 
			
				225
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				226
			 | 
			
			
				+detect_apps 
			 | 
		
	
		
			
			| 
				
			 | 
			
				227
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				228
			 | 
			
			
				+# if no applications were found 
			 | 
		
	
		
			
			| 
				
			 | 
			
				229
			 | 
			
			
				+if [[ ${#APPS_AVAILABLE[@]} == 0 ]]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				230
			 | 
			
			
				+	exit 1 
			 | 
		
	
		
			
			| 
				
			 | 
			
				231
			 | 
			
			
				+fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				232
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				233
			 | 
			
			
				+show_apps 
			 | 
		
	
		
			
			| 
				
			 | 
			
				234
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				235
			 | 
			
			
				+clear 
			 | 
		
	
		
			
			| 
				
			 | 
			
				236
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				237
			 | 
			
			
				+remove_apps 
			 | 
		
	
		
			
			| 
				
			 | 
			
				238
			 | 
			
			
				+install_apps 
			 | 
		
	
		
			
			| 
				
			 | 
			
				239
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				240
			 | 
			
			
				+exit 0 
			 |