Kaynağa Gözat

Prevent apps from being installed or removed during upgrades

Bob Mottram 6 yıl önce
ebeveyn
işleme
ab4b78778b
2 değiştirilmiş dosya ile 20 ekleme ve 0 silme
  1. 12
    0
      src/freedombone-addremove
  2. 8
    0
      src/freedombone-utils-selector

+ 12
- 0
src/freedombone-addremove Dosyayı Görüntüle

@@ -165,6 +165,12 @@ function remove_apps_selected {
165 165
         return
166 166
     fi
167 167
 
168
+    if [ -f /tmp/.upgrading ]; then
169
+        dialog --title $"Cannot remove apps" \
170
+               --msgbox $"A system upgrade is happening, so apps cannot be removed at this time" 6 60
171
+        return
172
+    fi
173
+
168 174
     # ask for confirmation
169 175
     dialog --title $"Remove applications" \
170 176
            --backtitle $"Freedombone" \
@@ -212,6 +218,12 @@ function install_apps_selected {
212 218
     fi
213 219
 
214 220
     if [[ "$select_all_apps" != "add-all" ]]; then
221
+        if [ -f /tmp/.upgrading ]; then
222
+            dialog --title $"Cannot install apps" \
223
+                   --msgbox $"A system upgrade is happening, so apps cannot be installed at this time" 6 60
224
+            return
225
+        fi
226
+
215 227
         # ask for confirmation
216 228
         if [ $n -eq 1 ]; then
217 229
             dialog --title $"$installs" \

+ 8
- 0
src/freedombone-utils-selector Dosyayı Görüntüle

@@ -496,6 +496,10 @@ function list_chosen_apps {
496 496
 }
497 497
 
498 498
 function remove_apps {
499
+    if [ -f /tmp/.upgrading ]; then
500
+        return
501
+    fi
502
+
499 503
     app_index=0
500 504
     # shellcheck disable=SC2068
501 505
     for a in ${APPS_AVAILABLE[@]}
@@ -617,6 +621,10 @@ function remove_users_for_app {
617 621
 function install_apps {
618 622
     is_interactive=$1
619 623
 
624
+    if [ -f /tmp/.upgrading ]; then
625
+        return
626
+    fi
627
+
620 628
     APP_INSTALLED_SUCCESS=1
621 629
 
622 630
     # interactive install configuration for each app