caplib.ksh revision aa3884f6c65ad5f3bc3816b4ef62749ba985b897
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# CDDL HEADER START
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# The contents of this file are subject to the terms of the
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# Common Development and Distribution License, Version 1.0 only
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# (the "License"). You may not use this file except in compliance
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# with the License.
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# See the License for the specific language governing permissions
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# and limitations under the License.
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# When distributing Covered Code, include this CDDL HEADER in each
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# If applicable, add the following below this CDDL HEADER, with the
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# fields enclosed by brackets "[]" replaced with your own identifying
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# information: Portions Copyright [yyyy] [name of copyright owner]
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# CDDL HEADER END
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# ident "%Z%%M% %I% %E% SMI"
aa3884f6c65ad5f3bc3816b4ef62749ba985b897ck# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# Use is subject to license terms.
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# This script is called by flarcreate.sh
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# Unmount all hwcap libraries (like /usr/lib/libc/libc_hwcap2.so.1)
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# and store commands needed to remount them in preexit/remount_hwcap.xxxx
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# scripts, which remounts them in the preexit phase.
aa3884f6c65ad5f3bc3816b4ef62749ba985b897ckif [ -z "$FLASH_PID" ]; then
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk echo "$0: ERROR: FLASH_PID not set in execution environment, exiting..."
a7123019ed2e4decef929dc2e426f3f310788fa1kucharskCMD_LIST="$CHMOD $ELFDUMP $MOUNT $UMOUNT $EGREP $SED"
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk if [ ! -x $cmd ]; then
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk echo "$0: ERROR: $cmd not found or not executable, exiting..."
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# Fill "LIBS" with a list of mounted libraries in the form:
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# MOUNTPOUNT:FILE
aa3884f6c65ad5f3bc3816b4ef62749ba985b897ckif [ ! "$LIBS" ]; then
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# Create the flash preexit script directory for the remount scripts if it
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# doesn't already exist.
a7123019ed2e4decef929dc2e426f3f310788fa1kucharskif [ ! -d $REMOUNT_DIR ]; then
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk echo "$0: ERROR: could not mkdir $REMOUNT_DIR, exiting..."
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# If an old remount script by this name exists, delete it
a7123019ed2e4decef929dc2e426f3f310788fa1kucharskif [ -f $REMOUNT ]; then
a7123019ed2e4decef929dc2e426f3f310788fa1kucharskif [ \"\$FLASH_PID\" != \"$FLASH_PID\" ]; then
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk /bin/rm -f $REMOUNT
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk echo "$0: ERROR: could not create $REMOUNT, exiting..."
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# Now process each of the libraries that are mounted. For each, find out if
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# it's a hwcap library; if it is, unmount it and write instructions to the
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# preexit script as to how to remount it.
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk echo "$MOUNT $MOUNTOPTS $MOUNTLIB $MOUNTPOINT" >> $REMOUNT
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# Write final cleanup instructions to the flash preexit remount script and make
a7123019ed2e4decef929dc2e426f3f310788fa1kucharsk# it executable.