guests/linux: POSIX sed [GH-6104]

This commit is contained in:
Mitchell Hashimoto 2015-11-19 18:35:18 -08:00
parent 240c393e69
commit f5cadc93fa
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