Commit 432bcc4bcd455d00ae50d7442aadb2b0b5e94ea8
Exists in
master
and in
17 other branches
Merge branch 'gitlab_shell_template' into 'master'
Gitlab Shell Template
Showing
2 changed files
with
11 additions
and
12 deletions
Show diff stats
config/software/gitlab-shell.rb
... | ... | @@ -28,18 +28,12 @@ build do |
28 | 28 | block do |
29 | 29 | env_shebang = "#!/usr/bin/env ruby" |
30 | 30 | `grep -r -l '^#{env_shebang}' #{project_dir}`.split("\n").each do |ruby_script| |
31 | - File.open(ruby_script, "r+") do |file| | |
32 | - script = file.read | |
33 | - file.rewind | |
34 | - file.truncate(0) | |
35 | - file.print <<-EOH | |
36 | -#!/opt/gitlab/embedded/bin/ruby | |
37 | -# Fix the PATH so that gitlab-shell can find git-upload-pack and friends. | |
38 | -ENV['PATH'] = '/opt/gitlab/bin:/opt/gitlab/embedded/bin:' + ENV['PATH'] | |
39 | - | |
40 | - EOH | |
41 | - file.print script.gsub(/^#{env_shebang}\s*/, "") | |
42 | - end | |
31 | + script = File.read(ruby_script) | |
32 | + next if script.start_with?("#!#{install_dir}") # Shebang looks good, skip this script | |
33 | + erb :dest => ruby_script, | |
34 | + :source => "ruby_script_wrapper.erb", | |
35 | + :mode => 0755, | |
36 | + :vars => {:script => script, :install_dir => install_dir} | |
43 | 37 | end |
44 | 38 | end |
45 | 39 | command "mkdir -p #{install_dir}/embedded/service/gitlab-shell" | ... | ... |