Browse Source

User accessible apps list

Bob Mottram 8 years ago
parent
commit
615aaf9b1f
2 changed files with 54 additions and 36 deletions
  1. 43
    36
      src/freedombone-utils-final
  2. 11
    0
      src/freedombone-utils-selector

+ 43
- 36
src/freedombone-utils-final View File

@@ -31,50 +31,57 @@
31 31
 OPEN_PORTS=()
32 32
 
33 33
 function install_final {
34
-	if grep -Fxq "install_final" $COMPLETION_FILE; then
35
-		return
36
-	fi
37
-	# unmount any attached usb drive
38
-	if [ -d $USB_MOUNT ]; then
39
-		umount $USB_MOUNT
40
-		rm -rf $USB_MOUNT
41
-	fi
42
-	function_check split_gpg_key_into_fragments
43
-	split_gpg_key_into_fragments
44
-	echo 'install_final' >> $COMPLETION_FILE
45
-	clear
46
-	echo ''
34
+    if grep -Fxq "install_final" $COMPLETION_FILE; then
35
+        return
36
+    fi
37
+    # unmount any attached usb drive
38
+    if [ -d $USB_MOUNT ]; then
39
+        umount $USB_MOUNT
40
+        rm -rf $USB_MOUNT
41
+    fi
42
+    function_check split_gpg_key_into_fragments
43
+    split_gpg_key_into_fragments
44
+    echo 'install_final' >> $COMPLETION_FILE
45
+    clear
46
+    echo ''
47 47
 
48
-	echo $"
49
-	*** ${PROJECT_NAME} installation is complete. Rebooting... ***
48
+    echo $"
49
+    *** ${PROJECT_NAME} installation is complete. Rebooting... ***
50 50
 
51
-	Now forward these ports from your internet router
51
+    Now forward these ports from your internet router
52 52
 "
53
-	for p in "${OPEN_PORTS[@]}"
54
-	do
55
-		echo "  $p"
56
-	done
57
-	echo ''
53
+    for p in "${OPEN_PORTS[@]}"
54
+    do
55
+        echo "  $p"
56
+    done
57
+    echo ''
58 58
 
59
-	if [ -f "/home/$MY_USERNAME/README" ]; then
60
-		echo $"See /home/$MY_USERNAME/README for post-installation instructions."
61
-		echo ''
62
-	fi
63
-	# add user menu on ssh login
64
-	if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then
65
-		echo 'control' >> /home/$MY_USERNAME/.bashrc
66
-	fi
67
-	if [ ! -f $IMAGE_PASSWORD_FILE ]; then
68
-		reboot
69
-	fi
59
+    if [ -f "/home/$MY_USERNAME/README" ]; then
60
+        echo $"See /home/$MY_USERNAME/README for post-installation instructions."
61
+        echo ''
62
+    fi
63
+    # add user menu on ssh login
64
+    if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then
65
+        echo 'control' >> /home/$MY_USERNAME/.bashrc
66
+    fi
67
+    if [ ! -f $IMAGE_PASSWORD_FILE ]; then
68
+        reboot
69
+    fi
70
+}
71
+
72
+function update_installed_apps_list {
73
+    cat $COMPLETION_FILE | grep "install_" > /usr/share/${PROJECT_NAME}/installed.txt
70 74
 }
71 75
 
72 76
 function setup_final {
73
-	function_check install_tripwire
74
-	install_tripwire
77
+    function_check update_installed_apps_list
78
+    update_installed_apps_list
79
+
80
+    function_check install_tripwire
81
+    install_tripwire
75 82
 
76
-	function_check install_final
77
-	install_final
83
+    function_check install_final
84
+    install_final
78 85
 }
79 86
 
80 87
 # NOTE: deliberately no exit 0

+ 11
- 0
src/freedombone-utils-selector View File

@@ -64,6 +64,15 @@ function app_is_installed {
64 64
         return
65 65
     fi
66 66
 
67
+    if [ -f /usr/share/${PROJECT_NAME}/installed.txt ]; then
68
+        if ! grep -Fxq "install_${app_name}" /usr/share/${PROJECT_NAME}/installed.txt; then
69
+            echo "0"
70
+        else
71
+            echo "1"
72
+        fi
73
+        return
74
+    fi
75
+
67 76
     if ! grep -Fxq "install_${app_name}" $COMPLETION_FILE; then
68 77
         echo "0"
69 78
     else
@@ -206,6 +215,7 @@ function remove_apps {
206 215
         fi
207 216
         app_index=$[app_index+1]
208 217
     done
218
+    update_installed_apps_list
209 219
 }
210 220
 
211 221
 function install_apps {
@@ -228,6 +238,7 @@ function install_apps {
228 238
         fi
229 239
         app_index=$[app_index+1]
230 240
     done
241
+    update_installed_apps_list
231 242
 }
232 243
 
233 244
 # NOTE: deliberately no exit 0