diff --git a/docker/PYROS_DOCKER_UPDATE b/docker/PYROS_DOCKER_UPDATE index bdb4b57..fb76496 100755 --- a/docker/PYROS_DOCKER_UPDATE +++ b/docker/PYROS_DOCKER_UPDATE @@ -1,8 +1,17 @@ #!/usr/bin/env bash # In docker/ folder -root_folder=$(pwd 2>&1) +docker_folder=$(pwd 2>&1) +# PRE-CONDITION : pyros container must be running +# If no container is running Start it +if ! [ $(docker ps | grep 'pyros' | wc -l) -eq 4 ] ; then + echo "pyros-db or pyros weren't running, starting them..." + ./PYROS_DOCKER_START + #./PYROS_DOCKER_START.bat +fi + +# Main function git pull & rebuild if necessary already_uptodate="Déjà à jour." check_files=("docker-compose.yml" "Dockerfile" "install/requirements.in" "install/requirements.txt" "doc_rst/requirements.in" "doc_rst/requirements.txt") check_files="${check_files[@]}" @@ -20,7 +29,6 @@ function git_pull { echo $gitpull_output # test only #gitpull_output=$gitpull_output."Dockerfile " - #gitpull_output=$gitpull_output."doc_rst/requirements.txt " # Check if exists file changed that requires rebuild #for file in "${check_files[@]}" for f in $check_files ; do @@ -30,10 +38,8 @@ function git_pull { echo "WARNING : One of docker related files ($f) has been changed. You should build again the PyROS Image before going on with the UPDATE..." echo "=> Build & start again the PyROS image ? ([y]/n)" read input ; [ -z ${input} ] && input="y" - #echo $answer [ $input != "y" ] && exit 1 - #echo $root_folder - (cd $root_folder && ./PYROS_DOCKER_BUILD && ./PYROS_DOCKER_START) + (cd $docker_folder && ./PYROS_DOCKER_BUILD && ./PYROS_DOCKER_START) # BUILF only once !!! break fi @@ -42,41 +48,22 @@ function git_pull { } -# PRE-CONDITION : pyros container must be running -# If no container is running Start it -if ! [ $(docker ps | grep 'pyros' | wc -l) -eq 4 ] ; then - echo "pyros-db or pyros weren't running, starting them..." - ./PYROS_DOCKER_START - #./PYROS_DOCKER_START.bat -fi - # I - Update Guitastro echo echo "**********************************" echo "I - Updating Guitastro source code" echo "**********************************" echo -# Go to GuitAstro/ folder git_pull ../vendor/guitastro/ -#check_files=("docker-compose.yml" "Dockerfile" "install/requirements.in") -#git_pull ../vendor/guitastro/ ${check_files[@]} # II - Update PyROS -#cd $root_folder echo echo "**********************************" echo "II - Updating PyROS source code" echo "**********************************" echo -# Go to PYROS/ folder git_pull ../ -# Check if exists file changed that requires rebuild -#check_files=("docker-compose.yml" "Dockerfile" "install/requirements.in") - - -# TODO : test if git pull worked and if git pull changed dockerfile, requirements.in, docker-compose.yml -# Tell user to rebuild # III - Update all observatories with git repo @@ -91,10 +78,11 @@ for dir in * ; do if [ -d $dir/.git ] ; then echo "Updating observatory $dir source code" git_pull $dir - #cd ../ fi done -cd ../PYROS/docker/ +#cd ../PYROS/docker/ +cd $docker_folder + # IV - pyros.py update => update BD + doc echo -- libgit2 0.21.2