added git_internal_dir init in postinst.sh
authorNico Cesar <nico@curoverse.com>
Tue, 19 Jan 2016 20:17:22 +0000 (15:17 -0500)
committerNico Cesar <nico@curoverse.com>
Tue, 19 Jan 2016 20:17:22 +0000 (15:17 -0500)
jenkins/rails-package-scripts/postinst.sh

index 1032d14e6fa0e3c415f722dc408849b3b7a2fa04..dfc58c5cdf8e8cb09d8ffa290f92b02713655b4e 100644 (file)
@@ -220,6 +220,23 @@ configure_version() {
           $COMMAND_PREFIX bundle exec rake config:check || APPLICATION_READY=0
   fi
 
+  # initialize git_internal_dir
+  # usually /var/lib/arvados/internal.git (set in application.default.yml )
+  if [ "$APPLICATION_READY" = "1" ]; then
+      GIT_INTERNAL_DIR=$($COMMAND_PREFIX bundle exec rake config:check 2>&1 | grep git_internal_dir | awk '{ print $2 }')
+      if [ -e "$GIT_INTERNAL_DIR" ]
+      then
+         run_and_report "Creating and initializing git_internal_dir '$GIT_INTERNAL_DIR'" \
+                        mkdir -p "$GIT_INTERNAL_DIR" && \
+                        chown "$WWW_OWNER:" "$GIT_INTERNAL_DIR" && \
+                        su -c "git init --bare $GIT_INTERNAL_DIR" "$WWW_OWNER:"
+      fi
+      run_and_report "Making sure '$GIT_INTERNAL_DIR' has the right permission" \
+                    chown -R "$WWW_OWNER:" "$GIT_INTERNAL_DIR"
+  else
+      echo "Initializing git_internal_dir... skipped."
+  fi
+
   # precompile assets; thankfully this does not take long
   if [ "$APPLICATION_READY" = "1" ]; then
       run_and_report "Precompiling assets" \