swapadd.sh revision 0e7f62d90a87bf733294fba2dead48f925bb2030
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (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
#
#
# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
# All rights reserved.
#
#
#ident "%Z%%M% %I% %E% SMI"
# Set noinuse checking during boot. We want to disable device in use checking
# swap devices to fail to be configured during boot.
USAGE="Usage: swapadd [-12] [file_system_table]"
#
# Check to see if there is an entry in the fstab for a specified file and
# mount it. This allows swap files (e.g. nfs files) to be mounted before
# being added for swap.
#
{
do
#
# Ignore comments, empty lines, and no-action lines
#
'#'* | '' | '-') continue ;;
esac
#
# If mount options are '-', default to 'rw'
#
echo "Mounting $rmountp for swap"
else
echo "Mount of $rmountp for swap failed"
fi
return
fi
done <$VFSTAB
}
die()
{
echo "$*" >& 2
exit 1
}
while getopts 12 opt; do
esac
done
#
# If $VFSTAB is not "-" (stdin), re-open stdin as the specified file
#
if [ "x$VFSTAB" != x- ]; then
exec <$VFSTAB
fi
#
# Read the file system table to find entries of file system type "swap".
# Add the swap device or file specified in the first column.
#
#
# Ignore comments, empty lines, and no-action lines
#
'#'* | '' | '-') continue ;;
esac
#
# Ignore non-swap fstypes
#
if [ $PASS = 1 ]; then
#
# Pass 1 should handle adding the swap files that
# are accessable immediately; block devices, files
# in / and /usr, and direct nfs mounted files.
#
if [ ! -b $special ]; then
#
# Read the file system table searching for mountpoints
# matching the swap file about to be added.
#
# NB: This won't work correctly if the file to added
# for swapping is a sub-directory of the mountpoint.
# e.g. swapfile-> servername:/export/swap/clientname
#
fi
fi
else
#
# Pass 2 should skip all the swap already added. If something
# added earlier uses the same name as something to be added
# later, the following test won't work. This should only happen
# if parts of a particular swap file are added or deleted by
# hand between invocations.
#
fi
done