Commit 6dec05ffb60c3f36c00032f3664ffcb1afbbb761

Authored by Jacob Vosmaer
2 parents 60467877 ea37040c

Merge branch 'gitlab_shell_path' into 'master'

Gitlab Shell Path
Showing 1 changed file with 17 additions and 1 deletions   Show diff stats
config/software/gitlab-shell.rb
... ... @@ -25,7 +25,23 @@ dependency "rsync"
25 25 source :git => "https://gitlab.com/gitlab-org/gitlab-shell.git"
26 26  
27 27 build do
28   - command "sed -i 's|^#!/usr/bin/env ruby|#!#{install_dir}/embedded/bin/ruby|' $(grep -r -l '#!/usr/bin/env ruby' .)"
  28 + block do
  29 + env_shebang = "#!/usr/bin/env ruby"
  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
  43 + end
  44 + end
29 45 command "mkdir -p #{install_dir}/embedded/service/gitlab-shell"
30 46 command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/gitlab-shell/"
31 47 end
... ...