Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion apps-enable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ BDIR="$( dirname "${0}" )"
NEXTCLOUD_DIR="${BDIR}/.."

. ${BDIR}/enabled-core-apps.inc.sh
. ${BDIR}/disabled-apps.inc.sh

ooc() {
php "${NEXTCLOUD_DIR}/occ" \
Expand All @@ -32,11 +33,25 @@ enable_app() {
fi
}

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
}

enable_apps() {
# Enable app in given directory
#
apps_dir="${1}"
_enabled_apps_count=0
_disabled_apps_count=0

if [ ! -d "${apps_dir}" ]; then
fail "Apps directory does not exist: $( readlink -f "${apps_dir}" )"
Expand All @@ -49,13 +64,32 @@ enable_apps() {
printf "Checking app: %s" "${app_name}"

if echo "${_enabled_apps}" | grep -q -w ${app_name}; then

if echo "${DISABLED_APPS}" | grep -q -w ${app_name}; then
echo " - currently enabled - disabling due to being in DISABLED_APPS"
disable_app "${app_name}"
_disabled_apps_count=$(( _disabled_apps_count + 1 ))
continue
fi

echo " - already enabled - skipping"
else

if echo "${DISABLED_APPS}" | grep -q -w ${app_name}; then
echo " - currently disabled - skipping due to being in DISABLED_APPS"
continue
fi

echo " - currently disabled - enabling"
enable_app "${app_name}"
_enabled_apps_count=$(( _enabled_apps_count + 1 ))
fi
done

echo
echo "Enabled ${_enabled_apps_count} apps in ${apps_dir}"
echo "Disabled ${_disabled_apps_count} apps in ${apps_dir}"
echo
}

enable_core_apps() {
Expand All @@ -73,14 +107,23 @@ enable_core_apps() {
fi

for app in ${ENABLED_CORE_APPS}; do
echo "Checking core app: ${app}"
printf "Checking core app: %s" "${app}"
if echo "${disabled_apps}" | grep -q -w ${app}; then

if echo "${DISABLED_APPS}" | grep -q -w ${app_name}; then
echo " - currently disabled - skipping due to being in DISABLED_APPS"
continue
fi

echo " - currently disabled - enabling"
enable_app "${app}"
_enabled_apps_count=$(( _enabled_apps_count + 1 ))
else
echo " - already enabled - skip"
fi
done

echo
echo "Enabled ${_enabled_apps_count} core apps."
echo "Done."
}
Expand All @@ -96,6 +139,7 @@ main() {
echo "Enable all apps in 'apps-custom' folder"
enable_apps "${NEXTCLOUD_DIR}/apps-custom"

echo "Enable all apps in 'apps' folder"
enable_core_apps
}

Expand Down