Convert DOS line endings to Unix in shell provisioner [GH-1495]
This commit is contained in:
parent
7524e7a3c0
commit
40e9ce6252
|
@ -24,6 +24,8 @@ BUG FIXES:
|
|||
multiple times. [GH-1467]
|
||||
- `vagrant box add` with a file path now works correctly on Windows
|
||||
when a drive letter is specified.
|
||||
- DOS line endings are converted to Unix line endings for the
|
||||
shell provisioner automatically. [GH-1495]
|
||||
|
||||
## 1.2.1 (April 17, 2013)
|
||||
|
||||
|
|
|
@ -48,13 +48,20 @@ module VagrantPlugins
|
|||
# on the remote server. This method will properly clean up the
|
||||
# script file if needed.
|
||||
def with_script_file
|
||||
script = nil
|
||||
|
||||
if config.path
|
||||
# Just yield the path to that file...
|
||||
root_path = @machine.env.root_path
|
||||
yield Pathname.new(config.path).expand_path(root_path)
|
||||
return
|
||||
script = Pathname.new(config.path).expand_path(root_path).read
|
||||
else
|
||||
# The script is just the inline code...
|
||||
script = config.inline
|
||||
end
|
||||
|
||||
# Replace Windows line endings with Unix ones
|
||||
script.gsub!(/\r\n?$/, "\n")
|
||||
|
||||
# Otherwise we have an inline script, we need to Tempfile it,
|
||||
# and handle it specially...
|
||||
file = Tempfile.new('vagrant-shell')
|
||||
|
@ -65,7 +72,7 @@ module VagrantPlugins
|
|||
file.binmode
|
||||
|
||||
begin
|
||||
file.write(config.inline)
|
||||
file.write(script)
|
||||
file.fsync
|
||||
file.close
|
||||
yield file.path
|
||||
|
|
Loading…
Reference in New Issue