diff --git a/configure.sh b/configure.sh index ffaa696..925707c 100755 --- a/configure.sh +++ b/configure.sh @@ -6,6 +6,8 @@ FAVICON_DIR=$(cd "${NEXTCLOUD_DIR}/apps-custom/nc_theming/img" && pwd) ADMIN_USERNAME=${ADMIN_USERNAME:-admin} ADMIN_EMAIL=${ADMIN_EMAIL:-admin@example.net} +. ${BDIR}/disabled-apps.inc.sh + ooc() { php occ \ "${@}" @@ -94,9 +96,39 @@ config_apps() { ooc config:app:set --value yes files sort_folders_first ooc config:app:set --value no files grid_view ooc config:app:set --value no files folder_tree +} +disable_app() { + # Disable app and check if it was disabled + # Fail if disabling the app failed + # + app_name="${1}" + echo "Disable app '${app_name}' ..." + + if ! ooc app:disable "${app_name}" + then + fail "Disable app \"${app_name}\" failed." + fi +} + +disable_apps() { echo "Disable apps" - ooc app:disable richdocuments + + _enabled_apps=$(./occ app:list --enabled --output json | jq -j '.enabled | keys | join("\n")') + _disabled_apps_count=0 + + for app_name in ${DISABLED_APPS}; do + printf "Checking app: %s" "${app_name}" + if echo "${_enabled_apps}" | grep -q -w "${app_name}"; then + echo " - currently enabled - disabling" + disable_app "${app_name}" + _disabled_apps_count=$(( _disabled_apps_count + 1 )) + else + echo " - not enabled - skip" + fi + done + + echo "Disabled ${_disabled_apps_count} apps." } add_config_partials() { @@ -145,6 +177,7 @@ main() { config_server config_apps config_ui + disable_apps } main "${@}" diff --git a/disabled-apps.inc.sh b/disabled-apps.inc.sh index 7c45895..d670482 100644 --- a/disabled-apps.inc.sh +++ b/disabled-apps.inc.sh @@ -10,6 +10,7 @@ firstrunwizard logreader nextcloud_announcements privacy +richdocuments recommendations related_resources serverinfo