]> git.parisson.com Git - docker-django-scripts.git/commitdiff
pull before update submodules
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 6 Mar 2018 16:34:47 +0000 (17:34 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 6 Mar 2018 16:34:47 +0000 (17:34 +0100)
build/local/setup_lib.sh [new file with mode: 0755]
build/readme.sh
build/setup_lib.sh [deleted file]
dev/pull.sh
dev/update.sh [new file with mode: 0755]
dev/update_submodules.sh [deleted file]
prod/push.sh
prod/update.sh [new file with mode: 0755]
prod/update_submodules.sh [deleted file]
prod/upgrade.sh

diff --git a/build/local/setup_lib.sh b/build/local/setup_lib.sh
new file mode 100755 (executable)
index 0000000..87bd14e
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+ls /srv/lib/
+for module in `ls /srv/lib/`; do
+       cd /srv/lib/$module
+       if [ -f 'requirements.txt' ]; then
+               pip install -r requirements.txt
+       else
+               python setup.py develop
+       fi
+done
index b73a0324e393f2efc39b1da67202bd751fafda53..65157276d3fa2bc18501b858534cb1f0894def1e 100755 (executable)
@@ -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/build/setup_lib.sh b/build/setup_lib.sh
deleted file mode 100755 (executable)
index 87bd14e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-ls /srv/lib/
-for module in `ls /srv/lib/`; do
-       cd /srv/lib/$module
-       if [ -f 'requirements.txt' ]; then
-               pip install -r requirements.txt
-       else
-               python setup.py develop
-       fi
-done
index 19dc2df309f0174974ab88ad396707f683245dcd..556e135412fc133e3c6fab3ec15e79af0ad407ec 100755 (executable)
@@ -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.sh b/dev/update.sh
new file mode 100755 (executable)
index 0000000..e0235af
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# The script detect the right main project branch, then update the submodule function of branch-[mainProjectBranch]
+# For example, if you define these variables in .gitmodules :
+# - branch-dev
+# - branch-master
+# If you are on dev branch in main project, the script will update submodule functions of branch-dev you've defined
+# 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
+if [ $curr_branch != "master" ] && [ $curr_branch != "dev" ];
+then
+    curr_branch="dev"
+fi
+
+function update_git_urls {
+    find ./ -type f \( -name ".gitmodules" -o -name "config" \)  -exec sed -i $REGEX {} +
+}
+
+REGEX='s/https:\/\/github.com\//git@github.com:/g'
+update_git_urls
+
+# checkout new submodule
+git submodule update --init
+# Synchronizes submodules' remote URL configuration setting to the value specified in .gitmodules
+git submodule sync
+# Checkout all submodules on right branches specified in .gitmodules, by default the branch is master
+git submodule foreach --recursive 'git checkout $(git config -f $toplevel/.gitmodules submodule.$name.branch-'$curr_branch' || echo master)'
+# Pull all submodules on right branches specified in .gitmodules, by default the branch is master
+git submodule foreach --recursive 'git pull origin $(git config -f $toplevel/.gitmodules submodule.$name.branch-'$curr_branch' || echo master)'
diff --git a/dev/update_submodules.sh b/dev/update_submodules.sh
deleted file mode 100755 (executable)
index fbd4bd4..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-
-# The script detect the right main project branch, then update the submodule function of branch-[mainProjectBranch]
-# For example, if you define these variables in .gitmodules :
-# - branch-dev
-# - branch-master
-# If you are on dev branch in main project, the script will update submodule functions of branch-dev you've defined
-# 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
-
-curr_branch=$(git symbolic-ref --short HEAD)
-
-echo $curr_branch
-if [ $curr_branch != "master" ] && [ $curr_branch != "dev" ];
-then
-    curr_branch="dev"
-fi
-
-function update_git_urls {
-    find ./ -type f \( -name ".gitmodules" -o -name "config" \)  -exec sed -i $REGEX {} +
-}
-
-REGEX='s/https:\/\/github.com\//git@github.com:/g'
-update_git_urls
-
-# checkout new submodule
-git submodule update --init
-# Synchronizes submodules' remote URL configuration setting to the value specified in .gitmodules
-git submodule sync
-# Checkout all submodules on right branches specified in .gitmodules, by default the branch is master
-git submodule foreach --recursive 'git checkout $(git config -f $toplevel/.gitmodules submodule.$name.branch-'$curr_branch' || echo master)'
-# Pull all submodules on right branches specified in .gitmodules, by default the branch is master
-git submodule foreach --recursive 'git pull origin $(git config -f $toplevel/.gitmodules submodule.$name.branch-'$curr_branch' || echo master)'
index fc7a2eb13b25b1c160327c492866105406153ead..8f0624039e5131f52c10420ae40086310bdca4c0 100755 (executable)
@@ -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.sh b/prod/update.sh
new file mode 100755 (executable)
index 0000000..4a684e9
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# The script detect the right main project branch, then update the submodule function of branch-[mainProjectBranch]
+# For example, if you define these variables in .gitmodules :
+# - branch-dev
+# - branch-master
+# If you are on dev branch in main project, the script will update submodule functions of branch-dev you've defined
+# 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
+if [ $curr_branch != "master" ] && [ $curr_branch != "dev" ];
+then
+    curr_branch="dev"
+fi
+
+function update_git_urls {
+    find ./ -type f \( -name ".gitmodules" -o -name "config" \)  -exec sed -i $REGEX {} +
+}
+
+REGEX='s/git@github.com:/https:\/\/github.com\//g'
+update_git_urls
+
+# checkout new submodule
+git submodule update --init
+# Synchronizes submodules' remote URL configuration setting to the value specified in .gitmodules
+git submodule sync
+# Checkout all submodules on right branches specified in .gitmodules, by default the branch is master
+git submodule foreach --recursive 'git checkout $(git config -f $toplevel/.gitmodules submodule.$name.branch-'$curr_branch' || echo master)'
+# Pull all submodules on right branches specified in .gitmodules, by default the branch is master
+git submodule foreach --recursive 'git pull origin $(git config -f $toplevel/.gitmodules submodule.$name.branch-'$curr_branch' || echo master)'
diff --git a/prod/update_submodules.sh b/prod/update_submodules.sh
deleted file mode 100755 (executable)
index fb27679..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-
-# The script detect the right main project branch, then update the submodule function of branch-[mainProjectBranch]
-# For example, if you define these variables in .gitmodules :
-# - branch-dev
-# - branch-master
-# If you are on dev branch in main project, the script will update submodule functions of branch-dev you've defined
-# 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
-
-curr_branch=$(git symbolic-ref --short HEAD)
-
-echo $curr_branch
-if [ $curr_branch != "master" ] && [ $curr_branch != "dev" ];
-then
-    curr_branch="dev"
-fi
-
-function update_git_urls {
-    find ./ -type f \( -name ".gitmodules" -o -name "config" \)  -exec sed -i $REGEX {} +
-}
-
-REGEX='s/git@github.com:/https:\/\/github.com\//g'
-update_git_urls
-
-# checkout new submodule
-git submodule update --init
-# Synchronizes submodules' remote URL configuration setting to the value specified in .gitmodules
-git submodule sync
-# Checkout all submodules on right branches specified in .gitmodules, by default the branch is master
-git submodule foreach --recursive 'git checkout $(git config -f $toplevel/.gitmodules submodule.$name.branch-'$curr_branch' || echo master)'
-# Pull all submodules on right branches specified in .gitmodules, by default the branch is master
-git submodule foreach --recursive 'git pull origin $(git config -f $toplevel/.gitmodules submodule.$name.branch-'$curr_branch' || echo master)'
index 43f8591ee7fadc022e4b7b8ac5ca7dac739e4df7..0450646061248164206c9a013651d1285a19aa35 100755 (executable)
@@ -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