<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='site:postboot'>
<service
name='site/postboot'
type='service'
version='1'>
<create_default_instance enabled='true' />
<single_instance />
<dependency
name='fs-root'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/system/filesystem/root' />
</dependency>
<exec_method
type='method'
name='start'
exec='/opt/custom/bin/postboot'
timeout_seconds='0'>
</exec_method>
<exec_method
type='method'
name='stop'
exec=':true'
timeout_seconds='0'>
</exec_method>
<property_group name='startd' type='framework'>
<propval name='duration' type='astring' value='transient' />
</property_group>
<stability value='Unstable' />
</service>
</service_bundle>
#!/bin/ksh
hostname $(</opt/custom/etc/nodename)
cp /opt/custom/etc/nodename /etc/nodename
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.