JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Installing Oracle Solaris 11.1 Systems     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

Part I Oracle Solaris 11.1 Installation Options

1.  Overview of Installation Options

Part II Installing Using Installation Media

2.  Preparing for the Installation

3.  Using Live Media

4.  Using the Text Installer

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

9.  Customizing Installations

10.  Provisioning the Client System

11.  Configuring the Client System

12.  Installing and Configuring Zones

13.  Running a Custom Script During First Boot

Implementing Run Once at First Boot Controls

How to Ensure One Run at First Boot

Creating a Script to Run at First Boot

Creating an SMF Manifest File

Using the Manifest Creation Tool

Customizing the Generated Manifest

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

Testing the First-Boot Service

How to Update the Script or Service

14.  Installing Client Systems

15.  Troubleshooting Automated Installations

Part IV Performing Related Tasks

A.  Working With Oracle Configuration Manager

B.  Using the Device Driver Utility

Index

Creating a Script to Run at First Boot

To know what source you can use for your script, you need to know what tools are installed on the client system at first boot. The solaris-large-server package is installed by default. If you installed that group package, you have Python, bash, ksh, and other tools available to you at first boot. For a complete list of packages that are included in the solaris-large-server group package, use the pkg contents command as described in Listing All Installable Packages in a Group Package in Adding and Updating Oracle Solaris 11.1 Software Packages. If you want to use a source for your script that is not available in the solaris-large-server package, identify the package you need and specify it in the AI manifest. For information about how to find the names of other packages that you might want to install, see Adding and Updating Oracle Solaris 11.1 Software Packages.


Tip -


Example 13-1 Template First-Boot Script

This example shows operations that should be done in any first-boot script.

Remember that by default, sh is ksh93.

#!/bin/sh

# Load SMF shell support definitions
. /lib/svc/share/smf_include.sh

# If nothing to do, exit with temporary disable
completed=`svcprop -p config/completed site/first-boot-script-svc:default`
[ "${completed}" = "true" ] && \
    smf_method_exit $SMF_EXIT_TEMP_DISABLE completed "Configuration completed"

# Obtain the active BE name from beadm: The active BE on reboot has an R in
# the third column of 'beadm list' output. Its name is in column one.
bename=`beadm list -Hd|nawk -F ';' '$3 ~ /R/ {print $1}'`
beadm create ${bename}.orig
echo "Original boot environment saved as ${bename}.orig"

# Place your one-time configuration tasks here

# Record that this script's work is done
svccfg -s site/first-boot-script-svc:default setprop config/completed = true
svcadm refresh site/first-boot-script-svc:default

smf_method_exit $SMF_EXIT_TEMP_DISABLE method_completed "Configuration completed"

Example 13-2 First-Boot Script that Configures Multiple IP Interfaces

This example shows a first-boot script named first-boot-script.sh that configures addresses on two IP interfaces and adds a default route.

#!/bin/sh

# Load SMF shell support definitions
. /lib/svc/share/smf_include.sh

# If nothing to do, exit with temporary disable
completed=`svcprop -p config/completed site/first-boot-script-svc:default`
[ "${completed}" = "true" ] && \
    smf_method_exit $SMF_EXIT_TEMP_DISABLE completed "Configuration completed"

# Obtain the active BE name from beadm: The active BE on reboot has an R in
# the third column of 'beadm list' output. Its name is in column one.
bename=`beadm list -Hd|nawk -F ';' '$3 ~ /R/ {print $1}'`
beadm create ${bename}.orig
echo "Original boot environment saved as ${bename}.orig"

# Create and configure addresses on two IP interfaces
/usr/sbin/ipadm create-ip net0
/usr/sbin/ipadm create-ip net1
/usr/sbin/ipadm create-addr -a 10.153.125.222/24 net0
/usr/sbin/ipadm create-addr -a 169.254.182.77/24 net1

# Add a default route with net0 as the gateway
/usr/sbin/route add default 10.153.125.1 -ifp net0

# Record that this script's work is done
svccfg -s site/first-boot-script-svc:default setprop config/completed = true
svcadm refresh site/first-boot-script-svc:default

smf_method_exit $SMF_EXIT_TEMP_DISABLE method_completed "Configuration completed"