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