Fix app removal lists

This commit is contained in:
Bob Mottram 2016-10-11 13:47:35 +01:00
parent 7785fd8542
commit 63ce7511ad
1 changed files with 12 additions and 1 deletions

View File

@ -43,6 +43,12 @@ APPS_INSTALLED_NAMES=()
# file containing a list of removed apps
REMOVED_APPS_FILE=/root/removed
INSTALLED_APPS_LIST=/usr/share/${PROJECT_NAME}/installed.txt
if [ ! $COMPLETION_FILE ]; then
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
fi
# Loads variables defined at the beginning of an app script
function app_load_variables {
app_name=$1
@ -148,6 +154,12 @@ function remove_app {
if ! grep -Fxq "_${app_name}_" $REMOVED_APPS_FILE; then
echo "_${app_name}_" >> $REMOVED_APPS_FILE
fi
if grep -Fxq "install_${app_name}" $COMPLETION_FILE; then
sed -i "/install_${app_name}/d" $COMPLETION_FILE
fi
if grep -Fxq "install_${app_name}" $INSTALLED_APPS_LIST; then
sed -i "/install_${app_name}/d" $INSTALLED_APPS_LIST
fi
}
# returns 1 if an app has been marked as removed
@ -182,7 +194,6 @@ function app_is_installed {
# Why does this secondary file exist, apart from COMPLETION_FILE ?
# It's so that it is visible to unprivileged users from the user control panel
INSTALLED_APPS_LIST=/usr/share/${PROJECT_NAME}/installed.txt
if [ -f $INSTALLED_APPS_LIST ]; then
if ! grep -Fxq "install_${app_name}" $INSTALLED_APPS_LIST; then
echo "0"