From 0a975c79a8cc8392bb0fafdf8dd2b4227af105a9 Mon Sep 17 00:00:00 2001 From: Evilham Date: Fri, 3 Jun 2022 19:07:53 +0200 Subject: [PATCH] [dd-ctl] Switch to main branch --- .gitmodules | 9 +-------- dd-ctl | 54 +++++++++++++++++++++++++++++++++-------------------- isard-apps | 1 - isard-sso | 1 - 4 files changed, 35 insertions(+), 30 deletions(-) delete mode 160000 isard-apps delete mode 160000 isard-sso diff --git a/.gitmodules b/.gitmodules index 3318806..8b13789 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,8 +1 @@ -[submodule "isard-apps"] - path = isard-apps - url = https://gitlab.com/isard/isard-apps - branch = master -[submodule "isard-sso"] - path = isard-sso - url = https://gitlab.com/isard/isard-sso - branch = master + diff --git a/dd-ctl b/dd-ctl index 291faf3..00dc8f0 100755 --- a/dd-ctl +++ b/dd-ctl @@ -38,7 +38,7 @@ help() { Stop the project when started: ./dd-ctl down Rescan nextcloud data folders: ./dd-ctl nextcloud-scan Install all prerequisites for installation: ./dd-ctl prerequisites - Update repository: ./dd-ctl repo-update [branch-name] (defaults to master) + Update repository: ./dd-ctl repo-update [branch-name] (defaults to main) Restart api if changes applied (development): ./dd-ctl restart-api Update SAML certificates: ./dd-ctl saml Set secure passwords in digitaldemocratic.conf: ./dd-ctl securize @@ -73,7 +73,7 @@ if [ "$OPERATION" != "prerequisites" ]; then fi fi -BRANCH="${2:-master}" +REPO_BRANCH="${2:-main}" cp digitaldemocratic.conf .env @@ -117,10 +117,24 @@ prerequisites_pwd(){ } update_repo(){ - git fetch && git checkout $BRANCH + # Switch to latest version + git fetch && git checkout $REPO_BRANCH + # Needed for dd-apps submodules... git submodule update --init --recursive - cd isard-apps && git fetch && git checkout $BRANCH && git pull && cd .. - cd isard-sso && git fetch && git checkout $BRANCH && git pull && cd .. + # Remove old repositories + for old_dir in isard-apps isard-sso; do + if [ -d "${old_dir}" ]; then + mkdir -p _old + mv "${old_dir}" "_old/${old_dir}_$(date +'%Y-%m-%d_%H-%M')" + fi + done + # Cleanup + for old_dir in isard-apps isard-sso; do + git submodule deinit "${old_dir}" || true + if [ -d "${old_dir}" ]; then + rmdir "${old_dir}" + fi + done } build_compose(){ @@ -458,43 +472,43 @@ upgrade_plugins_moodle(){ rm auth_saml2.zip if [[ "$MOODLE_PLUGIN_TRESIPUNTSHARE" == *"develop"* ]]; then - BRANCH=develop + PLUGIN_BRANCH=develop else - BRANCH=master + PLUGIN_BRANCH=master fi curl --location $MOODLE_PLUGIN_TRESIPUNTSHARE > tresipuntshare.zip unzip tresipuntshare.zip -d /tmp/moodle/mod/ - mv /tmp/moodle/mod/moodle_mod_tresipuntshare-$BRANCH /tmp/moodle/mod/tresipuntshare + mv /tmp/moodle/mod/moodle_mod_tresipuntshare-$PLUGIN_BRANCH /tmp/moodle/mod/tresipuntshare rm tresipuntshare.zip if [[ "$MOODLE_PLUGIN_TRESIPUNTVIDEO" == *"develop"* ]]; then - BRANCH=develop + PLUGIN_BRANCH=develop else - BRANCH=master + PLUGIN_BRANCH=master fi curl --location $MOODLE_PLUGIN_TRESIPUNTVIDEO > tresipuntvideo.zip unzip tresipuntvideo.zip -d /tmp/moodle/mod/ - mv /tmp/moodle/mod/moodle_mod_tresipuntvideo-$BRANCH /tmp/moodle/mod/tresipuntvideo + mv /tmp/moodle/mod/moodle_mod_tresipuntvideo-$PLUGIN_BRANCH /tmp/moodle/mod/tresipuntvideo rm tresipuntvideo.zip if [[ "$MOODLE_PLUGIN_TRESIPUNTAUDIO" == *"develop"* ]]; then - BRANCH=develop + PLUGIN_BRANCH=develop else - BRANCH=master + PLUGIN_BRANCH=master fi curl --location $MOODLE_PLUGIN_TRESIPUNTAUDIO > tresipuntaudio.zip unzip tresipuntaudio.zip -d /tmp/moodle/mod/ - mv /tmp/moodle/mod/moodle_mod_tresipuntaudio-$BRANCH /tmp/moodle/mod/tresipuntaudio + mv /tmp/moodle/mod/moodle_mod_tresipuntaudio-$PLUGIN_BRANCH /tmp/moodle/mod/tresipuntaudio rm tresipuntaudio.zip if [[ "$MOODLE_PLUGIN_ASSIGNSUBMISSION" == *"develop"* ]]; then - BRANCH=develop + PLUGIN_BRANCH=develop else - BRANCH=master + PLUGIN_BRANCH=master fi curl --location $MOODLE_PLUGIN_ASSIGNSUBMISSION > assignsubmission_tipnc.zip unzip assignsubmission_tipnc.zip -d /tmp/moodle/mod/assign/submission/ - mv /tmp/moodle/mod/assign/submission/moodle_assignsubmission_tipnc-$BRANCH /tmp/moodle/mod/assign/submission/tipnc + mv /tmp/moodle/mod/assign/submission/moodle_assignsubmission_tipnc-$PLUGIN_BRANCH /tmp/moodle/mod/assign/submission/tipnc rm assignsubmission_tipnc.zip curl --location $MOODLE_PLUGIN_TRESIPUNTMODSPEND > block_tresipuntmodspend.zip @@ -502,13 +516,13 @@ upgrade_plugins_moodle(){ rm block_tresipuntmodspend.zip if [[ "$MOODLE_THEME_CBE" == *"develop"* ]]; then - BRANCH=develop + PLUGIN_BRANCH=develop else - BRANCH=master + PLUGIN_BRANCH=master fi curl --location $MOODLE_THEME_CBE > tresipunt_theme_cbe.zip unzip tresipunt_theme_cbe.zip -d /tmp/moodle/theme/cbe/ - mv /tmp/moodle/theme/cbe/moodle_theme_cbe-$BRANCH/* /tmp/moodle/theme/cbe/ + mv /tmp/moodle/theme/cbe/moodle_theme_cbe-$PLUGIN_BRANCH/* /tmp/moodle/theme/cbe/ rm tresipunt_theme_cbe.zip #mkdir -p /tmp/moodle/local/tresipuntimportgc diff --git a/isard-apps b/isard-apps deleted file mode 160000 index c0f7ee1..0000000 --- a/isard-apps +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c0f7ee13b2c0daae32a4e05eb8411192038df0c0 diff --git a/isard-sso b/isard-sso deleted file mode 160000 index 3391e00..0000000 --- a/isard-sso +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3391e00cc32b03e6d12268f53c0bec2f4e2c74f5