update_grub.ksh revision e7cbe64f7a72dae5cb44f100db60ca88f3313c65
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# CDDL HEADER START
2f523b64504a53ab2ee3baf2cc417a936a07a13fjroberts# The contents of this file are subject to the terms of the
2f523b64504a53ab2ee3baf2cc417a936a07a13fjroberts# Common Development and Distribution License (the "License").
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# You may not use this file except in compliance with the License.
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# See the License for the specific language governing permissions
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# and limitations under the License.
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# When distributing Covered Code, include this CDDL HEADER in each
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# If applicable, add the following below this CDDL HEADER, with the
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# fields enclosed by brackets "[]" replaced with your own identifying
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# information: Portions Copyright [yyyy] [name of copyright owner]
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# CDDL HEADER END
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# Use is subject to license terms.
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# ident "%Z%%M% %I% %E% SMI"
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien ?) echo "Usage: ${0##*/}: [-R \<root\>]"
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien bootdev=`grep -v "^#" "$ALT_ROOT"/etc/vfstab | grep pcfs \
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# Detect SVM root and return the list of raw devices under the mirror
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien dev=`grep '^PHYS_SLICE' "$ALT_ROOT"/etc/lu/GRUB_slice |
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien fstyp -a "$dev" | grep 'path: ' | grep -v phys_path: |
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien rootpool=`df -k ${ALT_ROOT:-/} | tail +2 | cut -d/ -f1`
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien grep -v mirror | sed -n -e '/--/q' -e p | awk '{print $1}'`
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien if [[ $metadev = /dev/rdsk/* ]]; then
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien rootdevlist=`echo "$metadev" | sed -e "s#/dev/rdsk/##"`
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien metavol=`echo "$metadev" | sed -e "s#/dev/md/rdsk/##"`
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien# multiboot: install grub on the boot slice
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien if [ $is_pcfs_boot = yes ]; then
822fb41d6f36e90a1ec836b32f869e1235e7da40tsien # Note: /stubboot/boot/grub/stage2 must stay untouched.
bddc11567b8dc8b10ae555463608aad4f0c6cb44db cp "$ALT_ROOT"/boot/grub/menu.lst "$ALT_ROOT"/stubboot/boot/grub
bddc11567b8dc8b10ae555463608aad4f0c6cb44db bootdev=`grep -v "^#" "$ALT_ROOT"/etc/vfstab | grep pcfs | \
bddc11567b8dc8b10ae555463608aad4f0c6cb44db rpcfsdev=`echo "$bootdev" | sed -e "s/dev\/dsk/dev\/rdsk/"`
6dfee4834394825da35b977ca71cdc965bc7b6a4tsien $ALT_ROOT/sbin/bootadm update-menu -R ${ALT_ROOT:-/} \