create is_app_installed (#1103)

Co-authored-by: Daniel Hansson <github@hanssonit.se>
This commit is contained in:
szaimen 2020-02-23 18:05:25 +01:00 committed by GitHub
parent ee15a4bac1
commit f2e43d0910
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 32 deletions

View File

@ -58,7 +58,7 @@ then
fi
# Disable RichDocuments (Collabora App) if activated
if [ -d "$NC_APPS_PATH"/richdocuments ]
if is_app_installed richdocuments
then
occ_command app:remove richdocuments
fi
@ -74,7 +74,7 @@ then
docker_prune_this 'collabora/code'
# Disable RichDocuments (Collabora App) if activated
if [ -d "$NC_APPS_PATH"/richdocuments ]
if is_app_installed richdocuments
then
occ_command app:remove richdocuments
fi
@ -120,7 +120,7 @@ then
fi
# Disable OnlyOffice (Collabora App) if activated
if [ -d "$NC_APPS_PATH"/onlyoffice ]
if is_app_installed onlyoffice
then
occ_command app:remove onlyoffice
fi
@ -271,7 +271,7 @@ else
fi
# Set config for RichDocuments (Collabora App)
if [ -d "$NC_APPS_PATH"/richdocuments ]
if is_app_installed richdocuments
then
occ_command config:app:set richdocuments wopi_url --value=https://"$SUBDOMAIN"
chown -R www-data:www-data "$NC_APPS_PATH"

View File

@ -39,22 +39,19 @@ then
print_text_in_color "$ICyan" "Uninstalling Fulltextsearch..."
# Reset Full Text Search to be able to index again, and also remove the app to be able to install it again
if [ -d $NC_APPS_PATH/fulltextsearch ]
if is_app_installed fulltextsearch
then
print_text_in_color "$ICyan" "Removing old version of Full Text Search and resetting the app..."
sudo -u www-data php $NCPATH/occ fulltextsearch:reset
occ_command app:disable fulltextsearch
rm -rf $NC_APPS_PATH/fulltextsearch
occ_command_no_check fulltextsearch:reset
occ_command app:remove fulltextsearch
fi
if [ -d $NC_APPS_PATH/fulltextsearch_elasticsearch ]
if is_app_installed fulltextsearch_elasticsearch
then
occ_command app:disable fulltextsearch_elasticsearch
rm -rf $NC_APPS_PATH/fulltextsearch_elasticsearch
occ_command app:remove fulltextsearch_elasticsearch
fi
if [ -d $NC_APPS_PATH/files_fulltextsearch ]
if is_app_installed files_fulltextsearch
then
occ_command app:disable files_fulltextsearch
rm -rf $NC_APPS_PATH/files_fulltextsearch
occ_command app:remove files_fulltextsearch
fi
# Remove nc_fts docker if installed
@ -67,22 +64,19 @@ then
print_text_in_color "$ICyan" "Reinstalling FullTextSearch..."
# Reset Full Text Search to be able to index again, and also remove the app to be able to install it again
if [ -d $NC_APPS_PATH/fulltextsearch ]
if is_app_installed fulltextsearch
then
print_text_in_color "$ICyan" "Removing old version of Full Text Search and resetting the app..."
sudo -u www-data php $NCPATH/occ fulltextsearch:reset
occ_command app:disable fulltextsearch
rm -rf $NC_APPS_PATH/fulltextsearch
occ_command_no_check fulltextsearch:reset
occ_command app:remove fulltextsearch
fi
if [ -d $NC_APPS_PATH/fulltextsearch_elasticsearch ]
if is_app_installed fulltextsearch_elasticsearch
then
occ_command app:disable fulltextsearch_elasticsearch
rm -rf $NC_APPS_PATH/fulltextsearch_elasticsearch
occ_command app:remove fulltextsearch_elasticsearch
fi
if [ -d $NC_APPS_PATH/files_fulltextsearch ]
if is_app_installed files_fulltextsearch
then
occ_command app:disable files_fulltextsearch
rm -rf $NC_APPS_PATH/files_fulltextsearch
occ_command app:remove files_fulltextsearch
fi
# Remove nc_fts docker if installed
@ -103,12 +97,11 @@ then
fi
# Disable and remove Nextant + Solr
if [ -d "$NC_APPS_PATH"/nextant ]
if is_app_installed nextant
then
# Remove Nextant
msg_box "We will now remove Nextant + Solr and replace it with Full Text Search"
occ_command app:disable nextant
rm -rf $NC_APPS_PATH/nextant
occ_command app:remove nextant
# Remove Solr
service solr stop

View File

@ -46,7 +46,7 @@ then
install_and_enable_app previewgenerator
# check if the previewgenerator is installed and enabled
if [ -d "$NC_APPS_PATH/previewgenerator" ]
if is_app_installed previewgenerator
then
# enable previews
occ_command config:system:set enable_previews --value=true --type=boolean

View File

@ -166,7 +166,7 @@ check_open_port "$TURN_PORT" "$TURN_DOMAIN"
# Enable Spreed (Talk)
STUN_SERVERS_STRING="[\"$TURN_DOMAIN:$TURN_PORT\"]"
TURN_SERVERS_STRING="[{\"server\":\"$TURN_DOMAIN:$TURN_PORT\",\"secret\":\"$TURN_SECRET\",\"protocols\":\"udp,tcp\"}]"
if [ ! -d "$NC_APPS_PATH"/spreed ]
if ! is_app_installed spreed
then
install_and_enable_app spreed
occ_command config:app:set spreed stun_servers --value="$STUN_SERVERS_STRING" --output json
@ -174,7 +174,7 @@ then
chown -R www-data:www-data "$NC_APPS_PATH"
fi
if [ -d "$NC_APPS_PATH"/spreed ]
if is_app_installed spreed
then
msg_box "Nextcloud Talk is now installed. For more information about Nextcloud Talk and its mobile apps visit:
https://nextcloud.com/talk/"

14
lib.sh
View File

@ -694,9 +694,19 @@ else
fi
}
#example: is_app_installed documentserver_community
is_app_installed() {
if [ -d "$NC_APPS_PATH/$1" ]
then
return 0
else
return 1
fi
}
install_and_enable_app() {
# Download and install $1
if [ ! -d "$NC_APPS_PATH/$1" ]
if ! is_app_installed "$1"
then
print_text_in_color "$ICyan" "Installing $1..."
# occ_command not possible here because it uses check_command and will exit if occ_command fails
@ -713,7 +723,7 @@ or when a new version of the app is released with the following command:
rm -Rf "$NCPATH/apps/$1"
else
# Enable $1
if [ -d "$NC_APPS_PATH/$1" ]
if is_app_installed "$1"
then
occ_command app:enable "$1"
chown -R www-data:www-data "$NC_APPS_PATH"