From b20fe8d41ed9d18f59fb7b448d41d8d855879689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Norstr=C3=B6m?= Date: Thu, 19 Sep 2013 13:33:58 +0200 Subject: [PATCH] Dont replace Windows newlines to Unix if shell is set as binary --- plugins/provisioners/shell/config.rb | 3 +++ plugins/provisioners/shell/provisioner.rb | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/provisioners/shell/config.rb b/plugins/provisioners/shell/config.rb index 87dfa83c2..42425d7a4 100644 --- a/plugins/provisioners/shell/config.rb +++ b/plugins/provisioners/shell/config.rb @@ -8,6 +8,7 @@ module VagrantPlugins attr_accessor :upload_path attr_accessor :args attr_accessor :privileged + attr_accessor :binary def initialize @args = UNSET_VALUE @@ -15,6 +16,7 @@ module VagrantPlugins @path = UNSET_VALUE @upload_path = UNSET_VALUE @privileged = UNSET_VALUE + @binary = UNSET_VALUE end def finalize! @@ -23,6 +25,7 @@ module VagrantPlugins @path = nil if @path == UNSET_VALUE @upload_path = "/tmp/vagrant-shell" if @upload_path == UNSET_VALUE @privileged = true if @privileged == UNSET_VALUE + @binary = false if @binary == UNSET_VALUE end def validate(machine) diff --git a/plugins/provisioners/shell/provisioner.rb b/plugins/provisioners/shell/provisioner.rb index 8c288ee27..a7b3415d8 100644 --- a/plugins/provisioners/shell/provisioner.rb +++ b/plugins/provisioners/shell/provisioner.rb @@ -71,8 +71,8 @@ module VagrantPlugins script = config.inline end - # Replace Windows line endings with Unix ones - script.gsub!(/\r\n?$/, "\n") + # Replace Windows line endings with Unix ones unless binary file + script.gsub!(/\r\n?$/, "\n") unless config.binary # Otherwise we have an inline script, we need to Tempfile it, # and handle it specially...