Skip to content

Instantly share code, notes, and snippets.

View erikh's full-sized avatar
💭
Doing nothing so that nothing needs to be done

Erik Hollensbe erikh

💭
Doing nothing so that nothing needs to be done
View GitHub Profile
#!ruby
#
# small vagrant wannabe. uses ova files, imports the box if necessary, starts
# boxes if they aren't already started and starts a port forward based on their
# number. Does this in nice multithreaded ways so you could, you know, get more
# things done in less time.
#
# Cleaning up machines isn't solved -- you'll need to do that in the vbox
# console atm.
#
#!/usr/bin/env ruby
module MethodFromClass
def self.included(klass)
Object.send(:define_method, klass.to_s) do |*args|
klass.new(*args)
end
end
end
@jclulow
jclulow / 00_info.md
Created May 5, 2012 23:46
SmartOS rc.local

So, to get something like /etc/rc.local you can use the custom SMF import facility. (See the source for more information about how this actually works.)

/opt is mounted out of zones/opt by default. You can create a directory /opt/custom/smf and populate it with SMF manifests. Any manifests you put in there will be imported by SmartOS when it boots. Below is an example SMF manifest that simply starts /opt/custom/bin/postboot, a self-explanatory shell script that you can use like /etc/rc.local.

Note that it would likely be better to customise and respin your own images, as putting a bunch of platform state in the zones pool undoes some of the benefits of the ramdisk platform architecture that SmartOS has.