Merge branch 'master' into 8345-llfuse-unpin
[arvados-dev.git] / jenkins / rails-package-scripts / postinst.sh
index dfc58c5cdf8e8cb09d8ffa290f92b02713655b4e..6fac26be8eb34d56d31ccf73df3885501cdfe005 100644 (file)
@@ -94,11 +94,13 @@ setup_conffile() {
         # If there's a config file in /var/www identical to the one in /etc,
         # overwrite it with a symlink after porting its permissions.
         elif cmp --quiet "$release_conffile" "$etc_conffile"; then
-            local ownership="$(stat -c "%U:%G" "$release_conffile")"
+            local ownership="$(stat -c "%u:%g" "$release_conffile")"
+            local owning_group="${ownership#*:}"
+            if [ 0 != "$owning_group" ]; then
+                chgrp "$owning_group" "$CONFIG_PATH" /etc/arvados
+            fi
             chown "$ownership" "$etc_conffile"
             chmod --reference="$release_conffile" "$etc_conffile"
-            chgrp "${ownership#*:}" "$CONFIG_PATH" /etc/arvados
-            chmod g+rx "$CONFIG_PATH" /etc/arvados
             ln --force -s "$etc_conffile" "$release_conffile"
         fi
     fi
@@ -194,7 +196,7 @@ configure_version() {
   fi
 
   run_and_report "Running bundle install" \
-      $COMMAND_PREFIX bundle install --path $SHARED_PATH/vendor_bundle --quiet
+      $COMMAND_PREFIX bundle install --path $SHARED_PATH/vendor_bundle --local --quiet
 
   echo -n "Ensuring directory and file permissions ..."
   # Ensure correct ownership of a few files
@@ -220,23 +222,6 @@ 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" \
@@ -247,6 +232,8 @@ configure_version() {
   fi
   chown -R "$WWW_OWNER:" $RELEASE_PATH/tmp
 
+  setup_before_nginx_restart
+
   if [ ! -z "$WEB_SERVICE" ]; then
       service "$WEB_SERVICE" restart
   fi