Skip Navigation Links | |
Exit Print View | |
Installing Oracle Solaris 11 Systems Oracle Solaris 11 Information Library |
Part I Oracle Solaris 11 Installation Options
1. Overview of Installation Options
Part II Installing Using Installation Media
2. Preparing for the Installation
5. Automated Installations That Boot From Media
6. Unconfiguring or Reconfiguring an Oracle Solaris instance
Part III Installing Using an Install Server
7. Automated Installation of Multiple Clients
8. Setting Up an Install Server
10. Provisioning the Client System
11. Configuring the Client System
12. Installing and Configuring Zones
13. Running a Custom Script During First Boot
Creating a Script To Run at First Boot
Creating an IPS Package For the Script and Service
How To Create and Publish the IPS Package
Installing the First Boot Package on the AI Client
How To Install the IPS Package
14. Setting Up Oracle Configuration Manager For Use By AI Client Systems
Create an SMF manifest file that defines a transient service that executes a script.
The duration property near the end of the example service manifest below has the value transient. A transient service executes the start method once and does not execute it again if the method exits with $SMF_EXIT_OK. The svc.startd daemon does not try to restart the script after its first execution.
The start method of the service executes the first-boot script.
The name of the service in this example is site/first-boot-script-svc. After the client is booted, you can see the service in the output of the following command:
$ svcs -a|grep first-boot-script STATE STIME FMRI disabled 13:51:42 svc:/site/first-boot-script-svc:default
This example specifies the multi-user dependency to make sure that the first boot script executes late in the startup sequence after first boot. Depending on what your first boot script does, you might not need such a dependency. If you do not specify such a dependency, your script might run before the system is configured the way the script expects it to be.
Tip - Evaluate your script's dependencies and construct the service to run the script after its dependencies are satisfied.
Example 13-2 Sample SMF Service Manifest
The following file is the SMF manifest file for the first-boot-script-svc service: first-boot-script-svc-manifest.xml. This service is enabled by default and does not restart. The script that the service runs in this example is /opt/site/first-boot-script.sh.
<?xml version="1.0"?> <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> <service_bundle type='manifest' name='first-boot-script:site-first-boot-script-svc'> <service name='site/first-boot-script-svc' type='service' version='1'> <create_default_instance enabled='true' /> <single_instance /> <!-- Run the script late in the startup sequence after first boot. --> <dependency name='multi-user' grouping='require_all' restart_on='none' type='service'> <service_fmri value='svc:/milestone/multi-user:default' /> </dependency> <exec_method type='method' name='start' exec='/opt/site/first-boot-script.sh' timeout_seconds='360'> <method_context> <method_credential user='root'/> </method_context> </exec_method> <exec_method type='method' name='stop' exec=':true' timeout_seconds='60' /> <property_group name='startd' type='framework'> <propval name='duration' type='astring' value='transient' /> </property_group> </service> </service_bundle>