Commit ea37040cc1e7d53c66cc935096e0e977a0c9377a
1 parent
6f147e8d
Exists in
master
and in
17 other branches
Make the gitlab-shell PATH patch idempotent
On the second run there will not be an env shebang to replace.
Showing
1 changed file
with
3 additions
and
2 deletions
Show diff stats
config/software/gitlab-shell.rb
@@ -26,7 +26,8 @@ source :git => "https://gitlab.com/gitlab-org/gitlab-shell.git" | @@ -26,7 +26,8 @@ source :git => "https://gitlab.com/gitlab-org/gitlab-shell.git" | ||
26 | 26 | ||
27 | build do | 27 | build do |
28 | block do | 28 | block do |
29 | - `grep -r -l '#!/usr/bin/env ruby' #{project_dir}`.split("\n").each do |ruby_script| | 29 | + env_shebang = "#!/usr/bin/env ruby" |
30 | + `grep -r -l '^#{env_shebang}' #{project_dir}`.split("\n").each do |ruby_script| | ||
30 | File.open(ruby_script, "r+") do |file| | 31 | File.open(ruby_script, "r+") do |file| |
31 | script = file.read | 32 | script = file.read |
32 | file.rewind | 33 | file.rewind |
@@ -37,7 +38,7 @@ build do | @@ -37,7 +38,7 @@ build do | ||
37 | ENV['PATH'] = '/opt/gitlab/bin:/opt/gitlab/embedded/bin:' + ENV['PATH'] | 38 | ENV['PATH'] = '/opt/gitlab/bin:/opt/gitlab/embedded/bin:' + ENV['PATH'] |
38 | 39 | ||
39 | EOH | 40 | EOH |
40 | - file.print script | 41 | + file.print script.gsub(/^#{env_shebang}\s*/, "") |
41 | end | 42 | end |
42 | end | 43 | end |
43 | end | 44 | end |