i.rmmconf revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# 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
#
#
#ident "%Z%%M% %I% %E% SMI"
#
# Copyright (c) 1997 by Sun Microsystems, Inc.
# All rights reserved.
#
export PATH
{
d="$1"
old="$2"
new="$3"
# clean up
}
#
# update_action_line:
#
# takes three params:
# 1. dest file name;
# 2. new line to after last 'action ...' line;
# 3. old line to delete;
#
# algorithm:
# if the "$new" line is already in the file "$d", then return, else
# find the line number of the last "action ..." line in the "$d" file
# add the supplied "$new" line after the current last "action ..." line
# if the "$old" line is in the file, remove it
#
{
d="$1"
new="$2"
old="$3"
# check for the "$new line"
return # no work needs to be done
fi
# find last '^action ...' line
# add new line after last '^action ...' line
# copy temp file back to dest file, removing old line (if present)
}
{
d="$1"
# get the line and check if up to date
:
else
#edit ident ufs line
# clean up
fi
}
{
d="$1"
# check for the "$new line"
:
else
#edit ident pcfs line
# clean up
fi
}
{
d="$1"
new="$2"
:
# edit ident udfs line
else
# find last '^ident ...' line
# add new line after last '^ident ...' line
fi
# clean up
}
{
d="$1"
new="mount * hsfs udfs ufs -o nosuid"
flag=0
# check for the "new" line
flag=1
fi
nawk '
/^#/ {
# Comment Line
print;
next
}
/^mount/ {
# Mount Line
pcfs_flag=0
if ( match($0, /pcfs/) > 0 ) {
if ( match($0, /[ ](ufs|udfs|hsfs)/) <= 0 ) {
print;
next
}
else {
pcfs_flag=1;
}
}
if ( match($0, /(nosuid|suid)/) > 0 ){
print;
next
}
else {
if ( match($0, /-o/) > 0) {
pos = index($0, "-o");
string = substr($0, pos);
if (pcfs_flag == 1) {
print $1" " $2" " "pcfs " string;
sub(/pcfs[ ]*/, "");
}
sub(/-o[ ]/, "-o nosuid,");
print;
next
}
}
}
{
#Lines other than comment lines and those for mount options.
print;
next
}' $d > $file
then
else
fi
# Clean-up
}
do
if [ ! -f $dest ] ; then
else
# save the 'ident' line from the 'new' file
# save all but the 'ident' line from the old (orig) file
# concatenate the new ident and the old data, replacing old
# catch all just replace rmscsi with rmdisk everwhere
# in action as well as any other file systems added
# get the new 'action rmdisk ...' line
# ensure that default rmdisk line is up to date
'# there is no old action line to remove'
# ensure that default rmdisk line is up to date
"ident udfs ident_udfs.so cdrom floppy rmdisk"
# ensure that safe mount line is added
# restore permissions if they changed
fi
done
exit 0