nextcloud-kustom/overlays/dev/resources/nextcloud/cm-plugins-script.yaml
Philippe Caseiro 825a081839 feat(plugins): adding default apps install with env
New configmap cm-plugin-scripts uses NEXTCLOUD_PLUGIN_LIST env
to install apps

This script is runned on each pod "start"
2023-09-20 14:26:08 +02:00

35 lines
995 B
YAML

apiVersion: v1
kind: ConfigMap
metadata:
name: script-config-plugins
data:
poststart-plugins.sh: |
#!/bin/sh
set -eu
(
if ! flock -n 7; then
echo "Another process is installing plugins. waiting"
flock 7
exit 0
fi
echo "Installing default apps"
plugin_list="${NEXTCLOUD_PLUGIN_LIST}"
OPTS=""
occ="/var/www/html/occ"
installed_apps=$(mktemp)
/bin/sh -c "${occ} app:list" | awk '!/Enabled|Disabled/ {print substr($2, 1, length($2)-1)}' > "${installed_apps}"
for plugin in ${plugin_list}; do
if ! grep -q "${plugin}" "${installed_apps}"; then
/bin/sh -c "${occ} ${OPTS} app:install ${plugin}"
/bin/sh -c "${occ} ${OPTS} app:update ${plugin}"
/bin/sh -c "${occ} ${OPTS} app:enable ${plugin}"
else
echo "${plugin} allready installed"
fi
done
) 7> /var/www/html/nextcloud-plugin-install.lock
echo "Apps installation finished"