Procházet zdrojové kódy

Don't reinstall apps which have been removed during updates

Bob Mottram před 8 roky
rodič
revize
e6fbcf7db0
2 změnil soubory, kde provedl 53 přidání a 3 odebrání
  1. 1
    0
      src/freedombone-app-gnusocial
  2. 52
    3
      src/freedombone-utils-selector

+ 1
- 0
src/freedombone-app-gnusocial Zobrazit soubor

360
     remove_onion_service microblog ${MICROBLOG_ONION_PORT}
360
     remove_onion_service microblog ${MICROBLOG_ONION_PORT}
361
     sed -i '/install_gnusocial/d' $COMPLETION_FILE
361
     sed -i '/install_gnusocial/d' $COMPLETION_FILE
362
     sed -i '/GNU Social /d' $COMPLETION_FILE
362
     sed -i '/GNU Social /d' $COMPLETION_FILE
363
+    remove_app gnusocial
363
 }
364
 }
364
 
365
 
365
 function install_gnusocial_main {
366
 function install_gnusocial_main {

+ 52
- 3
src/freedombone-utils-selector Zobrazit soubor

40
 # A list of the names of installed apps
40
 # A list of the names of installed apps
41
 APPS_INSTALLED_NAMES=()
41
 APPS_INSTALLED_NAMES=()
42
 
42
 
43
+# file containing a list of removed apps
44
+REMOVED_APPS_FILE=/root/removed
45
+
43
 function app_variants {
46
 function app_variants {
44
     filename=$1
47
     filename=$1
45
     variants_line=$(cat ${filename} | grep "VARIANTS=")
48
     variants_line=$(cat ${filename} | grep "VARIANTS=")
57
     return 1
60
     return 1
58
 }
61
 }
59
 
62
 
63
+function remove_app {
64
+    app_name=$1
65
+    if [ ! -f $REMOVED_APPS_FILE ]; then
66
+        touch $REMOVED_APPS_FILE
67
+    fi
68
+    if ! grep -Fxq "$app_name" $REMOVED_APPS_FILE; then
69
+        echo "$app_name" >> $REMOVED_APPS_FILE
70
+    fi
71
+}
72
+
73
+function app_is_removed {
74
+    app_name="$1"
75
+    if [ ! -f $REMOVED_APPS_FILE ]; then
76
+        echo "0"
77
+        return
78
+    fi
79
+
80
+    if ! grep -Fxq "$app_name" $REMOVED_APPS_FILE; then
81
+        echo "0"
82
+    else
83
+        echo "1"
84
+    fi
85
+}
86
+
87
+function reinstall_app {
88
+    app_name=$1
89
+    if [ ! -f $REMOVED_APPS_FILE ]; then
90
+        return
91
+    fi
92
+    if [[ $(app_is_removed $app_name) == "1" ]]; then
93
+        sed -i "/${app_name}/d" $REMOVED_APPS_FILE
94
+    fi
95
+}
96
+
60
 function app_is_installed {
97
 function app_is_installed {
61
     app_name="$1"
98
     app_name="$1"
62
 
99
 
213
         if [[ ${APPS_INSTALLED[$app_index]} == "1" ]]; then
250
         if [[ ${APPS_INSTALLED[$app_index]} == "1" ]]; then
214
             if [[ ${APPS_CHOSEN[$app_index]} == "0" ]]; then
251
             if [[ ${APPS_CHOSEN[$app_index]} == "0" ]]; then
215
                 echo $"Removing application: ${a}"
252
                 echo $"Removing application: ${a}"
253
+                remove_app ${a}
216
                 remove_${a}
254
                 remove_${a}
217
                 echo $"${a} was removed"
255
                 echo $"${a} was removed"
218
             fi
256
             fi
246
     do
284
     do
247
         if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
285
         if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
248
             if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
286
             if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
249
-                echo $"Installing application: ${a}"
250
-                install_${a}
251
-                echo $"${a} was installed"
287
+                if [ ${is_interactive} ]; then
288
+                    reinstall_app ${a}
289
+                    echo $"Installing application: ${a}"
290
+                    install_${a}
291
+                    echo $"${a} was installed"
292
+                else
293
+                    if [[ $(app_is_removed ${a}) == "0" ]]; then
294
+                        echo $"Installing application: ${a}"
295
+                        install_${a}
296
+                        echo $"${a} was installed"
297
+                    else
298
+                        echo $"${a} has been removed and so will not be reinstalled"
299
+                    fi
300
+                fi
252
             fi
301
             fi
253
         fi
302
         fi
254
         app_index=$[app_index+1]
303
         app_index=$[app_index+1]