Systems documentation

This commit is contained in:
Mitchell Hashimoto 2010-04-25 17:14:31 -07:00
parent 7648fb1ad5
commit 0ddc6dd5f7
2 changed files with 57 additions and 0 deletions

View File

@ -14,6 +14,7 @@
</li>
<li><a href="/docs/boxes.html">Boxes</a></li>
<li><a href="/docs/base_boxes.html">Base Boxes</a></li>
<li><a href="/docs/systems.html">Systems</a></li>
<li><a href="/docs/rake.html">Rake Integration</a></li>
</ol>
</div>

56
docs/systems.md Normal file
View File

@ -0,0 +1,56 @@
---
layout: documentation
title: Documentation - Systems
---
# Systems
Systems are an abstraction within Vagrant which describe how various operating system specific
tasks are to be run. Systems abstract away tasks such as shutting down, mounting folders, etc.
since some operating systems handle this slightly different. This opens the door to supporting
more than unix-like systems.
<div class="info">
<h3>This topic is for advanced users</h3>
<p>
The following topic is for <em>advanced</em> users. The majority of Vagrant users
will never have to do this. Therefore, only continue if you want to support a non-linux
based operating system.
</p>
</div>
## System Tasks
The following is a list of tasks which are delegated to system classes:
* **Halting** - Shutting down the machine gracefully
* **Mounting Shared Folders** - Creating, mounting, and setting up the permissions
for shared folders.
This list will surely grow as Vagrant grows. For now, to implement a custom operating
system implementation, only the above two features need to be implemented.
## Creating a New System Implementer
Creating a new system implementer is quite simple: Inherit from `Vagrant::Systems::Base`
and implement the stubbed method on that class. Instead of going over each method here,
I'll point you to the [base source file](http://github.com/mitchellh/vagrant/blob/master/lib/vagrant/systems/base.rb)
which is thoroughly commented to explain each method.
## Using a New System Implementer
The new system implementer should be specified as the `config.vm.system` configuration
value. By default, this is `:linux`. A symbol represents a built-in system type. For
your custom types, you should set the value as the class name for your new implementer.
Below is a sample Vagrantfile which does just this:
{% highlight ruby %}
# An example system:
require 'bsd_system'
Vagrant::Config.run do |config|
# Set the system to the proper class name:
config.vm.system = BSDSystem
end
{% endhighlight %}
The configured Vagrant environment will then use the custom system implementation.