diff --git a/config/software/gitlab-shell.rb b/config/software/gitlab-shell.rb index 85b4d74..24ab394 100644 --- a/config/software/gitlab-shell.rb +++ b/config/software/gitlab-shell.rb @@ -28,18 +28,10 @@ build do block do env_shebang = "#!/usr/bin/env ruby" `grep -r -l '^#{env_shebang}' #{project_dir}`.split("\n").each do |ruby_script| - File.open(ruby_script, "r+") do |file| - script = file.read - file.rewind - file.truncate(0) - file.print <<-EOH -#!/opt/gitlab/embedded/bin/ruby -# Fix the PATH so that gitlab-shell can find git-upload-pack and friends. -ENV['PATH'] = '/opt/gitlab/bin:/opt/gitlab/embedded/bin:' + ENV['PATH'] - - EOH - file.print script.gsub(/^#{env_shebang}\s*/, "") - end + script = File.read(ruby_script) + erb :dest => ruby_script, + :source => "ruby_script_wrapper.erb", + :mode => 0755 end end command "mkdir -p #{install_dir}/embedded/service/gitlab-shell" diff --git a/config/templates/gitlab-shell/ruby_script_wrapper.erb b/config/templates/gitlab-shell/ruby_script_wrapper.erb new file mode 100644 index 0000000..50ef0ad --- /dev/null +++ b/config/templates/gitlab-shell/ruby_script_wrapper.erb @@ -0,0 +1,5 @@ +#!<%= install_dir %>/embedded/bin/ruby +# Fix the PATH so that gitlab-shell can find git-upload-pack and friends. +ENV['PATH'] = '<%= install_dir %>/bin:<%= install_dir %>/embedded/bin:' + ENV['PATH'] + +<%= script %> -- libgit2 0.21.2