digitaldemocratic/dd-apps/docker/moodle/03-plugins.sh

147 lines
7.1 KiB
Bash
Executable File

#
# Copyright © 2021,2022 IsardVDI S.L.
#
# This file is part of DD
#
# DD is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# DD is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License
# along with DD. If not, see <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: AGPL-3.0-or-later
if [ ! -f /var/www/html/config.php ]; then
mkdir -p "$SRC_FOLDER/moodle/mod/assign/submission"
mkdir -p "$SRC_FOLDER/moodle/auth/saml2"
mkdir -p "$SRC_FOLDER/moodle/theme/cbe"
mkdir -p "$SRC_FOLDER/moodle/blocks"
mkdir -p "$SRC_FOLDER/moodle/lib/editor/atto/plugins/tipnc"
#ADD plugins/auth_saml2.zip /var/www/html/
curl --location https://github.com/isard-vdi/moodle-auth_saml2/archive/refs/heads/role_map.zip > auth_saml2.zip
unzip auth_saml2.zip -d /var/www/html/auth/
mv /var/www/html/auth/moodle-auth_saml2-role_map /var/www/html/auth/saml2
rm auth_saml2.zip
curl --location "${MOODLE_PLUGIN_JITSI_OVERRIDE:-https://moodle.org/plugins/download.php/27002/mod_jitsi_moodle40_2022070602.zip}" > jitsi.zip
unzip jitsi.zip -d "$SRC_FOLDER/moodle/mod/"
rm jitsi.zip
curl --location "${MOODLE_PLUGIN_BBB_OVERRIDE:-https://moodle.org/plugins/download.php/26792/mod_bigbluebuttonbn_moodle311_2019101014.zip}" > bbb.zip
unzip bbb.zip -d "$SRC_FOLDER/moodle/mod/"
rm bbb.zip
# curl --location https://github.com/isard-vdi/moodle-auth_saml2/archive/refs/heads/role_map.zip > auth_saml2.zip
# curl --location https://moodle.org/plugins/download.php/24556/auth_saml2_moodle311_2021062900.zip > auth_saml2.zip
curl --location "${MOODLE_PLUGIN_SAML_OVERRIDE:-https://github.com/isard-vdi/moodle-auth_saml2/archive/refs/heads/role_map.zip}" > auth_saml2.zip
unzip auth_saml2.zip -d "$SRC_FOLDER/moodle/auth/"
mv "$SRC_FOLDER/moodle/auth/moodle-auth_saml2-role_map/*" "$SRC_FOLDER/moodle/auth/saml2/"
rm -rf "$SRC_FOLDER/moodle/auth/auth/moodle-auth_saml2-role_map"
rm auth_saml2.zip
M3IPSHARE="https://github.com/3iPunt/moodle_mod_tresipuntshare/archive/refs/heads/master.zip"
if [[ "${MOODLE_PLUGIN_TRESIPUNTSHARE_OVERRIDE:-${M3IPSHARE}}" == *"develop"* ]]; then
PLUGIN_BRANCH=develop
else
PLUGIN_BRANCH=master
fi
curl --location "${MOODLE_PLUGIN_TRESIPUNTSHARE_OVERRIDE:-${M3IPSHARE}}" > tresipuntshare.zip
unzip tresipuntshare.zip -d "$SRC_FOLDER/moodle/mod/"
mv "$SRC_FOLDER/moodle/auth/moodle_mod_tresipuntshare-$PLUGIN_BRANCH" "$SRC_FOLDER/moodle/auth/tresipuntshare"
rm tresipuntshare.zip
M3IPVIDEO="https://github.com/3iPunt/moodle_mod_tresipuntvideo/archive/refs/heads/master.zip"
if [[ "${MOODLE_PLUGIN_TRESIPUNTVIDEO_OVERRIDE:-${M3IPVIDEO}}" == *"develop"* ]]; then
PLUGIN_BRANCH=develop
else
PLUGIN_BRANCH=master
fi
curl --location "${MOODLE_PLUGIN_TRESIPUNTVIDEO_OVERRIDE:-${M3IPVIDEO}}" > tresipuntvideo.zip
unzip tresipuntvideo.zip -d "$SRC_FOLDER/moodle/mod/"
mv "$SRC_FOLDER/moodle/mod/moodle_mod_tresipuntvideo-$PLUGIN_BRANCH" "$SRC_FOLDER/moodle/mod/tresipuntvideo"
rm tresipuntvideo.zip
M3IPAUDIO="https://github.com/3iPunt/moodle_mod_tresipuntaudio/archive/refs/heads/master.zip"
if [[ "${MOODLE_PLUGIN_TRESIPUNTAUDIO_OVERRIDE:-${M3IPAUDIO}}" == *"develop"* ]]; then
PLUGIN_BRANCH=develop
else
PLUGIN_BRANCH=master
fi
curl --location "${MOODLE_PLUGIN_TRESIPUNTAUDIO_OVERRIDE:-${M3IPAUDIO}}" > tresipuntaudio.zip
unzip tresipuntaudio.zip -d "$SRC_FOLDER/moodle/mod/"
mv "$SRC_FOLDER/moodle/mod/moodle_mod_tresipuntaudio-$PLUGIN_BRANCH" "$SRC_FOLDER/moodle/mod/tresipuntaudio"
rm tresipuntaudio.zip
M3IPSUBMISSION="https://github.com/3iPunt/moodle_assignsubmission_tipnc/archive/refs/heads/master.zip"
if [[ "${MOODLE_PLUGIN_ASSIGNSUBMISSION_OVERRIDE:-${M3IPSUBMISSION}}" == *"develop"* ]]; then
PLUGIN_BRANCH=develop
else
PLUGIN_BRANCH=master
fi
curl --location "${MOODLE_PLUGIN_ASSIGNSUBMISSION_OVERRIDE:-${M3IPSUBMISSION}}" > assignsubmission_tipnc.zip
unzip assignsubmission_tipnc.zip -d "$SRC_FOLDER/moodle/mod/assign/submission/"
mv "$SRC_FOLDER/moodle/mod/assign/submission/moodle_assignsubmission_tipnc-$PLUGIN_BRANCH" "$SRC_FOLDER/moodle/mod/assign/submission/tipnc"
rm assignsubmission_tipnc.zip
M3IPSPEND="https://github.com/3iPunt/moodle_block_tresipuntmodspend/archive/refs/heads/master.zip"
curl --location "${MOODLE_PLUGIN_TRESIPUNTMODSPEND_OVERRIDE:-${M3IPSPEND}}" > block_tresipuntmodspend.zip
unzip block_tresipuntmodspend.zip -d "$SRC_FOLDER/moodle/blocks/"
rm block_tresipuntmodspend.zip
M3IPCBE="https://github.com/3iPunt/moodle_theme_cbe/archive/refs/heads/master.zip"
if [[ "${MOODLE_THEME_CBE_OVERRIDE:-${M3IPCBE}}" == *"develop"* ]]; then
PLUGIN_BRANCH=develop
else
PLUGIN_BRANCH=master
fi
curl --location "${MOODLE_THEME_CBE_OVERRIDE:-${M3IPCBE}}" > tresipunt_theme_cbe.zip
unzip tresipunt_theme_cbe.zip -d "$SRC_FOLDER/moodle/theme/cbe/"
mv "$SRC_FOLDER/moodle/theme/cbe/moodle_theme_cbe-$PLUGIN_BRANCH/*" "$SRC_FOLDER/moodle/theme/cbe/"
rm tresipunt_theme_cbe.zip
# mod_tipnextcloud
M3IPTN="https://github.com/3iPunt/mod_tipnextcloud/archive/refs/heads/master.zip"
if [[ "${MOODLE_MOD_TN_OVERRIDE:-${M3IPTN}}" == *"develop"* ]]; then
PLUGIN_BRANCH=develop
else
PLUGIN_BRANCH=master
fi
curl --location "${MOODLE_MOD_TN_OVERRIDE:-${M3IPTN}}" > tresipunt_mod_tn.zip
unzip tresipunt_mod_tn.zip -d "$SRC_FOLDER/moodle/mod/tipnextcloud/"
mv "$SRC_FOLDER/moodle/mod/tipnextcloud/mod_tipnextcloud-$PLUGIN_BRANCH/*" "$SRC_FOLDER/moodle/mod/tipnextcloud/"
rm tresipunt_mod_tn.zip
# atto_tipnc https://github.com/3iPunt/atto_tipnc
M3ATTOTIPTN="https://github.com/3iPunt/atto_tipnc/archive/refs/heads/master.zip"
if [[ "${MOODLE_ATTOTIPTN_OVERRIDE:-${M3ATTOTIPTN}}" == *"develop"* ]]; then
PLUGIN_BRANCH=develop
else
PLUGIN_BRANCH=master
fi
curl --location "${MOODLE_ATTOTIPTN_OVERRIDE:-https://github.com/3iPunt/atto_tipnc/archive/refs/heads/master.zip}" > tresipunt_atto_tipnc.zip
unzip tresipunt_atto_tipnc.zip -d "$SRC_FOLDER/moodle/lib/editor/atto/plugins/tipnc/"
mv "$SRC_FOLDER/moodle/lib/editor/atto/plugins/tipnc/atto_tipnc-$PLUGIN_BRANCH/*" "$SRC_FOLDER/moodle/lib/editor/atto/plugins/tipnc/"
rm tresipunt_atto_tipnc.zip
# local_mail
curl --location "${MOODLE_PLUGIN_MAIL_OVERRIDE:-https://moodle.org/plugins/download.php/26393/local_mail_moodle40_2017121407.zip}" > mail.zip
unzip mail.zip -d "$SRC_FOLDER/moodle/local/"
rm mail.zip
#mkdir -p /tmp/moodle/local/tresipuntimportgc
#cp -R local_plugins/moodle/tresipuntimportgc/* /tmp/moodle/local/tresipuntimportgc/
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/purge_caches.php
fi
chown -R nobody:root /var/www/html