When cleaning NFS, properly escape certain characters

This commit is contained in:
Mitchell Hashimoto 2013-02-08 16:18:57 -08:00
parent 0eef208d2d
commit a53d569656
1 changed files with 4 additions and 0 deletions

View File

@ -89,6 +89,10 @@ module VagrantPlugins
def nfs_cleanup(id)
return if !File.exist?("/etc/exports")
# Escape sed-sensitive characters:
id = id.gsub("/", "\\/")
id = id.gsub(".", "\\.")
# Use sed to just strip out the block of code which was inserted
# by Vagrant, and restart NFS.
system("sudo sed -e '/^# VAGRANT-BEGIN: #{id}/,/^# VAGRANT-END: #{id}/ d' -ibak /etc/exports")