A derived manifest example can be the best explanation about it:
: official documentation showing how to mirror the rpool during the installation.
: what's not shown or what I have changed based on the official documentation.
: official documentation showing the structure of a derived manifest.
$ cat /export/auto_install/files/derived.sh
#!/bin/bash -
SCRIPT_SUCCESS=0
SCRIPT_FAILURE=1
function error_handler
{
exit $SCRIPT_FAILURE
}
trap error_handler ERR
SCRIPT_SUCCESS=0
SCRIPT_FAILURE=1
function error_handler
{
exit $SCRIPT_FAILURE
}
trap error_handler ERR
# Define the location of the custom base manifest.
alias wget=/usr/bin/wget
alias aimanifest=/usr/bin/aimanifest
# Use the default if there is only one disk.
AI_SERVER=192.168.0.50:5555
AI_PATH=export/auto_install/$SI_INSTALL_SERVICE/auto_install
AI_BASE_MANIFEST=base.xml
alias wget=/usr/bin/wget
alias aimanifest=/usr/bin/aimanifest
# Load a base, customized, manifest which to dynamically adjust.
wget -P /tmp http://$AI_SERVER/$AI_PATH/$AI_BASE_MANIFEST
aimanifest load /tmp/$AI_BASE_MANIFESTwget -P /tmp http://$AI_SERVER/$AI_PATH/$AI_BASE_MANIFEST
# Use the default if there is only one disk.
if [[ $SI_NUMDISKS -ge 2 ]]
then
then
# Turn mirroring on.
# Assumes a root zpool is already set up.
vdev=$(aimanifest add -r target/logical/zpool[@name=rpool]/vdev@name mirror-0)
aimanifest set ${vdev}@redundancy mirror
# A 2-way mirror is enough.
typeset -i disk_num
for ((disk_num = 1; disk_num <= 2; disk_num++))
do
typeset -i disk_num
for ((disk_num = 1; disk_num <= 2; disk_num++))
do
eval curr_disk="$"SI_DISKNAME_${disk_num}
disk=$(aimanifest add -r target/disk@in_vdev mirror-0)
aimanifest set ${disk}@in_zpool rpool
aimanifest set ${disk}@whole_disk true
disk_name=$(aimanifest add -r ${disk}/disk_name@name $curr_disk)
aimanifest set ${disk_name}@name_type ctd
done
fi
exit $SCRIPT_SUCCESS