diff --git a/config/software/gitlab-core.rb b/config/software/gitlab-core.rb index 5da182f..c4800c7 100644 --- a/config/software/gitlab-core.rb +++ b/config/software/gitlab-core.rb @@ -61,21 +61,8 @@ build do command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/gitlab-core/" # Create a wrapper for the rake tasks of the Rails app - block do - open("#{install_dir}/bin/gitlab-rake", "w") do |file| - file.print <<-EOH -#!/bin/bash -export PATH=/opt/gitlab/bin:/opt/gitlab/embedded/bin:$PATH - -# default to RAILS_ENV=production -if [[ -z $RAILS_ENV ]]; then - export RAILS_ENV=production -fi - -cd /opt/gitlab/embedded/service/gitlab-core -/opt/gitlab/embedded/bin/chpst -u git -U git /opt/gitlab/embedded/bin/bundle exec rake "$@" -EOH - end - end - command "chmod +x #{install_dir}/bin/gitlab-rake" + erb :dest => "#{install_dir}/bin/gitlab-rake", + :source => "bundle_exec_wrapper.erb", + :mode => "775", + :vars => {:command => 'rake "$@"'} end diff --git a/config/templates/gitlab-core/bundle_exec_wrapper.erb b/config/templates/gitlab-core/bundle_exec_wrapper.erb new file mode 100644 index 0000000..deb2c1b --- /dev/null +++ b/config/templates/gitlab-core/bundle_exec_wrapper.erb @@ -0,0 +1,12 @@ +#!/bin/bash +export PATH=/opt/gitlab/bin:/opt/gitlab/embedded/bin:$PATH + +# default to RAILS_ENV=production +if [[ -z $RAILS_ENV ]]; then + export RAILS_ENV=production +fi + +gitlab_user=$(ls -lLd /opt/gitlab/embedded/service/gitlab-core/log | awk '{ print $3 }') + +cd /opt/gitlab/embedded/service/gitlab-core +/opt/gitlab/embedded/bin/chpst -u $gitlab_user -U $gitlab_user /opt/gitlab/embedded/bin/bundle exec <%= @command %> -- libgit2 0.21.2