]> git.parisson.com Git - docker-django-scripts.git/commitdiff
Fix var perms
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 28 Mar 2018 09:33:43 +0000 (11:33 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 28 Mar 2018 09:33:43 +0000 (11:33 +0200)
.gitmodules
dev/pull_data.sh
dev/update.sh
misc/fix_var_perms.sh [new file with mode: 0755]
prod/up.sh
prod/upgrade.sh

index 1372a4ddf29619cd88e4301474b2f92c73ff47e8..de78f8d10b96ffbf91bb5379c216a9dc1ef95e3a 100644 (file)
@@ -1,3 +1,3 @@
 [submodule "install"]
        path = install
-       url = git@github.com:yomguy/docker-composition-installer.git
+       url = https://github.com/yomguy/docker-composition-installer.git
index 41936d9f8ab2f608e77bbfe36eee693633068292..e825dcc1654598c0eee748b14a4a73602f91e331 100755 (executable)
@@ -1,10 +1,10 @@
 #!/bin/bash
 
-cd "$(dirname "$0")"/../../var
+cd "$(dirname "$0")"/../../
 
-# We need to chown folders as they are docker's volumes
-sudo chown -R $USER media
-sudo chown -R $USER backup
+bin/misc/fix_var_perms.sh
+
+cd "$(dirname "$0")"/../../var/
 
 git pull
 
@@ -12,10 +12,3 @@ git pull
 if [ "$1" = "--restore-db" ]; then
     docker-compose run db /srv/bin/dev/restore_db.sh
 fi
-
-# We need to chown folders as they are docker's volumes
-# (do not work on OSX, hence the test)
-if ! uname -a | grep Darwin > /dev/null; then
-  sudo chown -R www-data media
-  sudo chown -R root backup
-fi
index 8b8d4668c52748a9183a600bb47c110a9b88610e..b999a479378ee18549b5514c4ceaebf99483e5b3 100755 (executable)
 
 cd "$(dirname "$0")"/../../
 
-# We need to chown folders as they are docker's volumes
-if ! uname -a | grep Darwin > /dev/null; then
-    sudo chown -R $USER var/media
-    sudo chown -R $USER var/backup
-fi
+bin/misc/fix_var_perms.sh
 
 # Update main project
 git pull
diff --git a/misc/fix_var_perms.sh b/misc/fix_var_perms.sh
new file mode 100755 (executable)
index 0000000..09aff73
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+cd "$(dirname "$0")"/../../
+
+# We need to chown folders so that they can be used by the $USER (with an exception on Darwin)
+if ! uname -a | grep Darwin > /dev/null; then
+    INFO=( $(stat -L -c "%a %G %U" var) )
+    OWNER=${INFO[2]}
+    if [ "$OWNER" != "$USER" ]; then
+        sudo chown $USER var
+        sudo chown -R $USER var/media
+        sudo chown -R $USER var/backup
+    fi
+fi
index 07fa2c48432748dd233fdbf814da5d64d9eebd30..4c4f1f741df9f18e0a6e39d99bdb78ada4c3e6dd 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/sh
+
 options = ""
+
 if [ "$1" = "-bg" ]; then
     options = $options "-d";
 fi
-docker-compose -f docker-compose.yml -f env/prod.yml up $options
\ No newline at end of file
+
+docker-compose -f docker-compose.yml -f env/prod.yml up $options
index fb9a797491f9bc7a0a5c757514ef4219f7e65d59..a5f23827cee977f1214494eb1692c5e145f0c9ae 100755 (executable)
@@ -2,8 +2,6 @@
 
 cd "$(dirname "$0")"/../../
 
-
-
 function usage() {
     echo "upgrade the Mezzo production instance with various options"
     echo ""