Merge pull request #6565 from mitchellh/b-posix-sed

guests/linux: POSIX sed [GH-6104]
This commit is contained in:
Mitchell Hashimoto 2015-11-19 18:37:17 -08:00
commit 82fa09ca87
1 changed files with 4 additions and 2 deletions

View File

@ -10,8 +10,10 @@ module VagrantPlugins
machine.communicate.tap do |comm|
if comm.test("test -f ~/.ssh/authorized_keys")
comm.execute(
"sed -i '/^.*#{contents}.*$/d' ~/.ssh/authorized_keys")
comm.execute(<<SCRIPT)
sed -e '/^.*#{contents}.*$/d' ~/.ssh/authorized_keys > ~/.ssh/authorized_keys.new
mv ~/.ssh/authorized_keys.new ~/.ssh/authorized_keys
SCRIPT
end
end
end