diff --git a/lib/vagrant/actions/vm/shared_folders.rb b/lib/vagrant/actions/vm/shared_folders.rb index f18ca639c..774f0618c 100644 --- a/lib/vagrant/actions/vm/shared_folders.rb +++ b/lib/vagrant/actions/vm/shared_folders.rb @@ -57,10 +57,10 @@ module Vagrant def setup_unison return if unison_folders.empty? - logger.info "Setting up unison crontab..." runner.ssh.execute do |ssh| runner.system.prepare_unison(ssh) + logger.info "Creating unison crontab entries..." unison_folders.each do |name, data| runner.system.create_unison(ssh, data) end diff --git a/lib/vagrant/systems/linux.rb b/lib/vagrant/systems/linux.rb index 6552f7f68..ccef07d68 100644 --- a/lib/vagrant/systems/linux.rb +++ b/lib/vagrant/systems/linux.rb @@ -53,6 +53,8 @@ module Vagrant end def prepare_unison(ssh) + ssh.exec!("which unison", :error_key => :unison_not_found) + logger.info "Preparing system for unison sync..." vm.ssh.upload!(StringIO.new(TemplateRenderer.render('/unison/script')), config.unison.script) ssh.exec!("sudo chmod +x #{config.unison.script}") diff --git a/templates/strings.yml b/templates/strings.yml index db7ee0cf4..6f279d477 100644 --- a/templates/strings.yml +++ b/templates/strings.yml @@ -212,6 +212,11 @@ :system_unspecified: |- A VM system type must be specified! This is done via the `config.vm.system` configuration value. Please read the documentation online for more information. +:unison_not_found: |- + The `unison` binary was not found on the guest machine. This is required + for folder syncing via unison. Please install unison on your system to + use folder syncing. You may also disable folder syncing, install unison, + re-enable syncing, then call a `vagrant reload` to enable syncing. :unknown_vm: |- The specified VM could not be found: <%= vm %> :virtualbox_import_failure: |-