Don't reinstall apps which have been removed during updates
This commit is contained in:
parent
2b6710e415
commit
e6fbcf7db0
|
@ -360,6 +360,7 @@ function remove_gnusocial {
|
||||||
remove_onion_service microblog ${MICROBLOG_ONION_PORT}
|
remove_onion_service microblog ${MICROBLOG_ONION_PORT}
|
||||||
sed -i '/install_gnusocial/d' $COMPLETION_FILE
|
sed -i '/install_gnusocial/d' $COMPLETION_FILE
|
||||||
sed -i '/GNU Social /d' $COMPLETION_FILE
|
sed -i '/GNU Social /d' $COMPLETION_FILE
|
||||||
|
remove_app gnusocial
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_gnusocial_main {
|
function install_gnusocial_main {
|
||||||
|
|
|
@ -40,6 +40,9 @@ APPS_CHOSEN=()
|
||||||
# A list of the names of installed apps
|
# A list of the names of installed apps
|
||||||
APPS_INSTALLED_NAMES=()
|
APPS_INSTALLED_NAMES=()
|
||||||
|
|
||||||
|
# file containing a list of removed apps
|
||||||
|
REMOVED_APPS_FILE=/root/removed
|
||||||
|
|
||||||
function app_variants {
|
function app_variants {
|
||||||
filename=$1
|
filename=$1
|
||||||
variants_line=$(cat ${filename} | grep "VARIANTS=")
|
variants_line=$(cat ${filename} | grep "VARIANTS=")
|
||||||
|
@ -57,6 +60,40 @@ function item_in_array {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function remove_app {
|
||||||
|
app_name=$1
|
||||||
|
if [ ! -f $REMOVED_APPS_FILE ]; then
|
||||||
|
touch $REMOVED_APPS_FILE
|
||||||
|
fi
|
||||||
|
if ! grep -Fxq "$app_name" $REMOVED_APPS_FILE; then
|
||||||
|
echo "$app_name" >> $REMOVED_APPS_FILE
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function app_is_removed {
|
||||||
|
app_name="$1"
|
||||||
|
if [ ! -f $REMOVED_APPS_FILE ]; then
|
||||||
|
echo "0"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep -Fxq "$app_name" $REMOVED_APPS_FILE; then
|
||||||
|
echo "0"
|
||||||
|
else
|
||||||
|
echo "1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function reinstall_app {
|
||||||
|
app_name=$1
|
||||||
|
if [ ! -f $REMOVED_APPS_FILE ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [[ $(app_is_removed $app_name) == "1" ]]; then
|
||||||
|
sed -i "/${app_name}/d" $REMOVED_APPS_FILE
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function app_is_installed {
|
function app_is_installed {
|
||||||
app_name="$1"
|
app_name="$1"
|
||||||
|
|
||||||
|
@ -213,6 +250,7 @@ function remove_apps {
|
||||||
if [[ ${APPS_INSTALLED[$app_index]} == "1" ]]; then
|
if [[ ${APPS_INSTALLED[$app_index]} == "1" ]]; then
|
||||||
if [[ ${APPS_CHOSEN[$app_index]} == "0" ]]; then
|
if [[ ${APPS_CHOSEN[$app_index]} == "0" ]]; then
|
||||||
echo $"Removing application: ${a}"
|
echo $"Removing application: ${a}"
|
||||||
|
remove_app ${a}
|
||||||
remove_${a}
|
remove_${a}
|
||||||
echo $"${a} was removed"
|
echo $"${a} was removed"
|
||||||
fi
|
fi
|
||||||
|
@ -246,9 +284,20 @@ function install_apps {
|
||||||
do
|
do
|
||||||
if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
|
if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
|
||||||
if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
|
if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
|
||||||
echo $"Installing application: ${a}"
|
if [ ${is_interactive} ]; then
|
||||||
install_${a}
|
reinstall_app ${a}
|
||||||
echo $"${a} was installed"
|
echo $"Installing application: ${a}"
|
||||||
|
install_${a}
|
||||||
|
echo $"${a} was installed"
|
||||||
|
else
|
||||||
|
if [[ $(app_is_removed ${a}) == "0" ]]; then
|
||||||
|
echo $"Installing application: ${a}"
|
||||||
|
install_${a}
|
||||||
|
echo $"${a} was installed"
|
||||||
|
else
|
||||||
|
echo $"${a} has been removed and so will not be reinstalled"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
app_index=$[app_index+1]
|
app_index=$[app_index+1]
|
||||||
|
|
Loading…
Reference in New Issue