瀏覽代碼

Fix app removal lists

Bob Mottram 8 年之前
父節點
當前提交
63ce7511ad
共有 1 個文件被更改,包括 12 次插入1 次删除
  1. 12
    1
      src/freedombone-utils-selector

+ 12
- 1
src/freedombone-utils-selector 查看文件

@@ -43,6 +43,12 @@ APPS_INSTALLED_NAMES=()
43 43
 # file containing a list of removed apps
44 44
 REMOVED_APPS_FILE=/root/removed
45 45
 
46
+INSTALLED_APPS_LIST=/usr/share/${PROJECT_NAME}/installed.txt
47
+
48
+if [ ! $COMPLETION_FILE ]; then
49
+    COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
50
+fi
51
+
46 52
 # Loads variables defined at the beginning of an app script
47 53
 function app_load_variables {
48 54
     app_name=$1
@@ -148,6 +154,12 @@ function remove_app {
148 154
     if ! grep -Fxq "_${app_name}_" $REMOVED_APPS_FILE; then
149 155
         echo "_${app_name}_" >> $REMOVED_APPS_FILE
150 156
     fi
157
+    if grep -Fxq "install_${app_name}" $COMPLETION_FILE; then
158
+        sed -i "/install_${app_name}/d" $COMPLETION_FILE
159
+    fi
160
+    if grep -Fxq "install_${app_name}" $INSTALLED_APPS_LIST; then
161
+        sed -i "/install_${app_name}/d" $INSTALLED_APPS_LIST
162
+    fi
151 163
 }
152 164
 
153 165
 # returns 1 if an app has been marked as removed
@@ -182,7 +194,6 @@ function app_is_installed {
182 194
 
183 195
     # Why does this secondary file exist, apart from COMPLETION_FILE ?
184 196
     # It's so that it is visible to unprivileged users from the user control panel
185
-    INSTALLED_APPS_LIST=/usr/share/${PROJECT_NAME}/installed.txt
186 197
     if [ -f $INSTALLED_APPS_LIST ]; then
187 198
         if ! grep -Fxq "install_${app_name}" $INSTALLED_APPS_LIST; then
188 199
             echo "0"