2N/A# The contents of this file are subject to the terms of the 2N/A# Common Development and Distribution License (the "License"). 2N/A# You may not use this file except in compliance with the License. 2N/A# See the License for the specific language governing permissions 2N/A# and limitations under the License. 2N/A# When distributing Covered Code, include this CDDL HEADER in each 2N/A# If applicable, add the following below this CDDL HEADER, with the 2N/A# fields enclosed by brackets "[]" replaced with your own identifying 2N/A# information: Portions Copyright [yyyy] [name of copyright owner] 2N/A# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A# The arguments to this script are the zone name and the zonepath. 2N/A# Run the s10_support boot hook. 2N/Aif (( $? != 0 ));
then 2N/A# Replace the specified file in the booting zone with a wrapper script that 2N/A# invokes s10_isaexec_wrapper. This is a convenience function that reduces 2N/A# clutter and code duplication. 2N/A# $2 The access mode of the replacement file in hex (e.g., 0555) 2N/A# $3 The name of the replacement file's owner (e.g., root:bin) 2N/A# $4 Optional: the full path of the native file 2N/A# NOTE: The checks performed in the 'if' statement below are not generic: they 2N/A# depend on the success of the zone filesystem structure validation performed 2N/A# above to ensure that intermediate directories exist and aren't symlinks. 2N/A# Create a new wrapper script that invokes s10_isaexec_wrapper in the 2N/A# brand (for a non-existing s10c file) pointing to the native brand file. 2N/A# This function assumes there is no s10 version of the replacement file, 2N/A# so there is nothing to back up. 2N/A# $1 The full path of the wrapper file to create 2N/A# $2 The access mode of the replacement file in hex (e.g., 0555) 2N/A# $3 The name of the replacement file's owner (e.g., root:bin) 2N/A# Before we boot we validate and fix, if necessary, the required files within 2N/A# the zone. These modifications can be lost if a patch is applied within the 2N/A# zone, so we validate and fix the zone every time it boots. 2N/A# This section of the boot script is responsible for replacing Solaris 10 2N/A# binaries within the booting zone with Nevada binaries. This is a two-step 2N/A# process: First, the directory structure of the zone is validated to ensure 2N/A# that binary replacement will proceed safely. Second, Solaris 10 binaries 2N/A# are replaced with Nevada binaries. 2N/A# Here's an example. Suppose that you want to replace /usr/bin/zcat with the 2N/A# 1. Go to the section below labeled "STEP ONE" and add the following 2N/A# These lines ensure that both /usr and /usr/bin are directories 2N/A# within the booting zone that can be safely accessed by the global 2N/A# 2. Go to the section below labeled "STEP TWO" and add the following 2N/A# Details about the binary replacement procedure can be found in the Solaris 10 2N/A# Containers Developer Guide. 2N/A# Validate that the zone filesystem looks like we expect it to. 2N/A# Some of the native networking daemons such as in.mpathd are 2N/A# Replace Solaris 10 binaries with Nevada binaries. 2N/A# Replace various network-related programs with native wrappers. 2N/A# Replace IPFilter commands with native wrappers 2N/A# Create ipmgmtd wrapper to native binary in s10 container 2N/A# and copy ipmgmt service method. 2N/A# Create wrapper for native netcfgd. 2N/A# To handle certain IPMP configurations, we need updated 2N/A# To make updates to /var, wrap the s10 fs-minimal script. 2N/A# Make sure the most recent version of fs minimal is backed up 2N/A# so that s10_fs_minimal uses is the up-to-date version. 2N/Aif (( $? != 0 )) ;
then 2N/A# S10 container, the kernel will return EINVAL. So we need this. 2N/A# Replace various ZFS-related programs with native wrappers. These commands 2N/A# either link with libzfs, dlopen libzfs or link with libraries that link 2N/A# or dlopen libzfs. Commands which fall into these categories but which can 2N/A# only be used in the global zone are not wrapped. The libdiskmgt dm_in_use 2N/A# code uses libfs, but only the zpool_in_use() -> zpool_read_label() code path. 2N/A# That code does not issue ioctls on /dev/zfs and does not need wrapping. 2N/A# Replace automount and automountd with native wrappers. 2N/A# Replace rstatd with native, as it depends on struct mib2_ipAddrEntry_t 2N/A# Replace truss and mdb with their native counterparts. The architecture 2N/A# specific versions are updated, as truss and mdb will exec these directly 2N/A# when the current binary does not match the target process. 2N/A# The class-specific dispadmin(1M) and priocntl(1) binaries must be native 2N/A# wrappers, and we must have all of the ones the native zone does. This 2N/A# allows new scheduling classes to appear without causing dispadmin and 2N/A# priocntl to be unhappy. 2N/A# install or remove drivers will work. NOTE: add_drv and rem_drv are hard 2N/A# linked to isaexec so we want to remove the current executable and 2N/A# then copy true so that we don't clobber isaexec.