From 1f41411429defb3561d87d56a3062e7cac1102d4 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Tue, 6 Mar 2018 17:34:47 +0100 Subject: [PATCH] pull before update submodules --- build/{ => local}/setup_lib.sh | 0 build/readme.sh | 4 +++- dev/pull.sh | 7 ++----- dev/{update_submodules.sh => update.sh} | 5 +++++ prod/push.sh | 5 +++++ prod/{update_submodules.sh => update.sh} | 5 +++++ prod/upgrade.sh | 7 ++----- 7 files changed, 22 insertions(+), 11 deletions(-) rename build/{ => local}/setup_lib.sh (100%) rename dev/{update_submodules.sh => update.sh} (96%) rename prod/{update_submodules.sh => update.sh} (96%) diff --git a/build/setup_lib.sh b/build/local/setup_lib.sh similarity index 100% rename from build/setup_lib.sh rename to build/local/setup_lib.sh diff --git a/build/readme.sh b/build/readme.sh index b73a032..6515727 100755 --- a/build/readme.sh +++ b/build/readme.sh @@ -1,4 +1,6 @@ -#!/bin/sh +#!/bin/bash + +cd "$(dirname "$0")"/../../ cat doc/src/overview.rst doc/src/architecture.rst doc/src/install.rst doc/src/development.rst doc/src/maintenance.rst doc/src/copyright.rst doc/src/license.rst > README.rst echo "Build finished. The README.rst file is up to date." diff --git a/dev/pull.sh b/dev/pull.sh index 19dc2df..556e135 100755 --- a/dev/pull.sh +++ b/dev/pull.sh @@ -6,11 +6,8 @@ cd "$(dirname "$0")"/../../ sudo chown -R $USER var/media sudo chown -R $USER var/backup -# Update main project -git pull - -# Update submodules -./bin/dev/update_submodules.sh +# Update main project and submodules +./bin/dev/update.sh # Restore database if [ "$1" = "--restore-db" ]; then diff --git a/dev/update_submodules.sh b/dev/update.sh similarity index 96% rename from dev/update_submodules.sh rename to dev/update.sh index fbd4bd4..e0235af 100755 --- a/dev/update_submodules.sh +++ b/dev/update.sh @@ -8,6 +8,11 @@ # In main project, if you are in another branch than master or dev, it will take by default dev branch # If you don't define any branches for you submodule, the script will update from master +cd "$(dirname "$0")"/../../ + +# Update main project +git pull + curr_branch=$(git symbolic-ref --short HEAD) echo $curr_branch diff --git a/prod/push.sh b/prod/push.sh index fc7a2eb..8f06240 100755 --- a/prod/push.sh +++ b/prod/push.sh @@ -1,9 +1,14 @@ #!/bin/bash +cd "$(dirname "$0")"/../../ + echo "----------------------------" echo `date +\%Y\%m\%d-\%H-\%M-\%S` + docker-compose run db /srv/bin/prod/backup_db.sh + cd var + git add . git commit -a -m "update DB and media" git pull diff --git a/prod/update_submodules.sh b/prod/update.sh similarity index 96% rename from prod/update_submodules.sh rename to prod/update.sh index fb27679..4a684e9 100755 --- a/prod/update_submodules.sh +++ b/prod/update.sh @@ -8,6 +8,11 @@ # In main project, if you are in another branch than master or dev, it will take by default dev branch # If you don't define any branches for you submodule, the script will update from master +cd "$(dirname "$0")"/../../ + +# Update main project +git pull + curr_branch=$(git symbolic-ref --short HEAD) echo $curr_branch diff --git a/prod/upgrade.sh b/prod/upgrade.sh index 43f8591..0450646 100755 --- a/prod/upgrade.sh +++ b/prod/upgrade.sh @@ -2,11 +2,8 @@ cd "$(dirname "$0")"/../../ -# Update main project -git pull - -# Update submodules -./bin/update_submodules.sh +# Update main project and submodules +./bin/prod/update.sh # Apply migrations if [ "$1" = "--migrate" ]; then -- 2.39.5