From 3fa0d4885822e21e59a4e53b92260a918ea9fc12 Mon Sep 17 00:00:00 2001 From: Evilham Date: Mon, 8 Aug 2022 11:58:04 +0200 Subject: [PATCH] [dd-ctl] Adapt update subcommand with all actions This way existing installations can just run ./dd-ctl update and have a working environment with the latest version. --- dd-ctl | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/dd-ctl b/dd-ctl index 1f34039..41e353c 100755 --- a/dd-ctl +++ b/dd-ctl @@ -49,7 +49,6 @@ help() { Example: ./dd.ctl [operation] [arguments] For a new installation, you usually will want to run: - ./dd-ctl repo-update ./dd-ctl prerequisites ./dd-ctl securize ./dd-ctl all @@ -67,7 +66,7 @@ help() { Generate .orig and .patch files to compare with upstream: ./dd-ctl genpatches 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 main) + Update DD to latest version: ./dd-ctl 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 dd.conf: ./dd-ctl securize @@ -154,25 +153,20 @@ prerequisites_pwd(){ apt-get install -y dictionaries-common wamerican } -update_repo(){ +ddupdate(){ + # Bring down services + ./dd-ctl down # Switch to latest version git fetch && git checkout $REPO_BRANCH + git pull --rebase --autostash # Needed for dd-apps submodules... git submodule update --init --recursive - # 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 + # Rebuild containers + ./dd-ctl build + # Upgrade plugins + ./dd-ctl upgrade-plugins + # Reapply customisations if needed + ./dd-ctl customize } build_compose(){ @@ -788,8 +782,8 @@ case "$OPERATION" in prerequisites_docker prerequisites_pwd ;; - repo-update) - update_repo + update|repo-update) + ddupdate ;; reset-data|reset-1714) cat <<-EOF