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

Document Information

Preface

Part I Oracle Solaris 11 Installation Options

1.  Overview of Installation Options

Part II Installing Using Installation Media

2.  Preparing for the Installation

3.  Using the LiveCD

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

Creating a Script To Run at First Boot

Creating an SMF Manifest File

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

15.  Installing Client Systems

16.  Troubleshooting Automated Installations

Creating a Script To Run at First Boot

Near the top of the SMF service manifest shown in Creating an SMF Manifest File, the service is enabled by the following line:

<create_default_instance enabled='true' />

At the end of your first-boot script, disable the service and uninstall the package so that the first-boot script runs only one time.

#!/bin/sh

svcadm disable svc:/site/first-boot-script-svc:default
pkg uninstall pkg:/first-boot-script

exit $SMF_EXIT_OK

In this example, first-boot-script-svc is the SMF service created in Creating an SMF Manifest File, and first-boot-script is the IPS package created in Creating an IPS Package For the Script and Service.


Tip -


Example 13-1 Sample First-Boot Script

This example shows a sample first-boot script named /opt/site/first-boot-script.sh. This script first saves a copy of the boot environment (BE) that was just created by the AI installation. Saving a copy of the BE before the first-boot script modifies it enables you to easily recover from any problems introduced by the script by booting into the saved BE.

#!/bin/sh

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

echo "Save original boot environment first."
# 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

# Add support for faster serial console
echo "Setting up support for faster serial console"
! grep console115200 >/dev/null /etc/ttydefs && \
    echo "console115200:115200 hupcl opost onlcr:115200::console115200" \
    >>/etc/ttydefs

echo "Configure ssh server for root login and X11 forwarding"
ed - << EOF
r /etc/ssh/sshd_config
/PermitRootLogin/
c
PermitRootLogin yes
.
/X11Forwarding/
c
X11Forwarding yes
.
w
q
EOF
svcadm refresh ssh

# Set up coreadm
echo "Setting core file configuration"
coreadm -G default -g /var/cores/%f.%u.%p.%t.core
coreadm -e global
coreadm -e process
coreadm -e proc-setid
coreadm -e log

# Disable service and uninstall package
svcadm disable svc:/site/first-boot-script-svc:default
pkg uninstall pkg:/first-boot-script

echo "Site first-boot script done. Rebooting in 5 seconds." > /dev/console

sleep 5 && reboot -p || reboot &

exit $SMF_EXIT_OK