A finish script is a user-defined Bourne shell script, specified within the rules file, that performs tasks after the Solaris software is installed on a system, but before the system reboots. You can use finish scripts only when using custom JumpStart to install Solaris.
Adding files
Adding individual packages or patches in addition to the ones installed in a particular software group
Customizing the root environment
Setting the system's root password
The Solaris 8 Interactive Installation Program mounts the system's file systems onto /a. The file systems remain mounted on /a until the system reboots. Therefore, you can use the finish script to add, change, or remove files from the newly installed file system hierarchy by modifying the file systems respective to /a.
Output from the finish script is deposited in /var/sadm/finish.log.
Ensure that root owns the finish script and that its permissions are set to 644.
Through a finish script, you can add files from the JumpStart directory to an already installed system. This is possible because the JumpStart directory is mounted on the directory specified by the SI_CONFIG_DIR variable (which is set to /tmp/install_config by default).
You can also replace files by copying files from the JumpStart directory to already existing files on the installed system.
The following procedure enables you to create a finish script to add files to a system after the Solaris software is installed on it:
Copy all the files you want added to the installed system into the JumpStart directory.
Insert the following line into the finish script for each file you want copied into the newly installed file system hierarchy:
cp ${SI_CONFIG_DIR}/file_name /a/path_name |
For example, assume you have a special application, site_prog, developed for all users at your site. If you place a copy of site_prog into the JumpStart directory, the following line in a finish script copies site_prog from the JumpStart directory into a system's /usr/bin directory during a custom JumpStart installation:
cp ${SI_CONFIG_DIR}/site_prog /a/usr/bin |
You can create a finish script to automatically add packages or patches after Solaris is installed on a system. Adding packages in this way not only saves time, but ensures consistency in what packages and patches are installed on different systems at your site.
When using the pkgadd(1M) or patchadd(1M) commands in your finish scripts, use the -R option to specify /a as the root path.
Example 19–1 shows an example of a finish script that adds packages.
#!/bin/sh BASE=/a MNT=/a/mnt ADMIN_FILE=/a/tmp/admin mkdir ${MNT} mount -f nfs sherlock:/export/package ${MNT} [Mounts a directory on a server that contains the package to install.] cat >${ADMIN_FILE} <<DONT_ASK [Creates a temporary package administration file, admin, to force the pkgadd(1M) command not to perform checks (and prompt for questions) when installing a package. This enables you to maintain a hands-off installation when you are adding packages.] mail=root instance=overwrite partial=nocheck runlevel=nocheck idepend=nocheck rdepend=nocheck space=ask setuid=nocheck conflict=nocheck action=nocheck basedir=default DONT_ASK /usr/sbin/pkgadd -a ${ADMIN_FILE} -d ${MNT} -R ${BASE} SUNWxyz [Adds the package by using the -a option (specifying the package administration file) and the -R option (specifying the root path).] umount ${MNT} rmdir ${MNT} |
In the past, the chroot(1M) command was used with the pkgadd and patchadd commands in the finish script environment. In the rare instances in which some packages or patches do not work with the -R option, you must create a dummy /etc/mnttab file in the /a root path before issuing the chroot command.
To create a dummy /etc/mnttab file, add the following line to your finish script:
cp /etc/mnttab /a/etc/mnttab
You can also use finish scripts to customize files already installed on a system. For example, the finish script in Example 19–2 customizes the root environment by appending information to the .cshrc file in the root (/) directory.
#!/bin/sh # # Customize root's environment # echo "***adding customizations in /.cshrc" test -f a/.cshrc || { cat >> a/.cshrc <<EOF set history=100 savehist=200 filec ignoreeof prompt="\$user@`uname -n`> " alias cp cp -i alias mv mv -i alias rm rm -i alias ls ls -FC alias h history alias c clear unset autologout EOF } |
After Solaris software is installed on a system, the system reboots. Before the boot process is completed, the system prompts for the root password. Until someone enters a password, the system cannot finish booting.
A finish script called set_root_pw in the auto_install_sample directory shows how to avoid this problem by setting the root password automatically, without prompting. set_root_pw is shown in Example 19–3.
If you set the system's root password by using a finish script, safeguard against those who might attempt to discover the root password from the encrypted password in your finish script.