i.voldconf revision 18c2aff776a775d34a4c9893a4c72e0434d68e36
#
# 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 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
export PATH
{
# add the new remount lines after the notify line
source_file="$1"
dest_file="$2"
:
else
sed -e "$line_number a\\
cp /tmp/tmp.$$ $dest_file
fi
sed -e "$line_number a\\
cp /tmp/tmp.$$ $dest_file
fi
fi
}
#
# update_use_line:
#
# takes three params:
# 1. dest file name;
# 2. new line to go after last 'use ...' 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 "use ..." line in the "$d" file
# add the supplied "$new" line after the current last "use ..." 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 '^use ...' line
# add new line after last '^use ...' line
# copy temp file back to dest file, removing old line (if present)
}
#
# update_notify_line
#
# takes one param:
# 1. dest file name;
#
# algorithm:
# - find the current "notify ..." line
# - if the current line ends with "-c" and the line has no 'use='
# clause, then
# - change the "-c" to a "-p", and
# - add a 'user=root' clause
#
{
d="$1"
# get the current notify line
# check for "-c"
if [ $? != 0 ] ; then
# '-c' not found
return # not an orig line -- just leave it alone
fi
# check for not having a 'user=' clause
if [ $? = 0 ] ; then
# 'user=' found
return # not an orig line -- just leave it alone
fi
# update the notify line to have a 'user=root' and a '-p'
# move result back
}
{
d="$1"
# get the line and check if up to date
:
:
else
#edit label sun line
# clean up
fi
}
{
d="$1"
# get the line and check if up to date
:
:
else
#edit label dos line
# clean up
fi
}
{
d="$1"
do
then
return
fi
done
}
{
# add the new support nomedia lines after the db line
source_file="$1"
dest_file="$2"
:
else
line_number=`expr $line_number + 1`
sed -e "$line_number a\\
# Volfs support of removable media devices" $dest_file > /tmp/tmp.$$
cp /tmp/tmp.$$ $dest_file
line_number=`expr $line_number + 1`
sed -e "$line_number a\\
support nomedia" $dest_file > /tmp/tmp.$$
cp /tmp/tmp.$$ $dest_file
line_number=`expr $line_number + 1`
sed -e "$line_number a\\
" $dest_file > /tmp/tmp.$$
cp /tmp/tmp.$$ $dest_file
fi
fi
}
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
# get the new 'use cdrom ...' line
# ensure that default cdrom line is up to date
'use cdrom drive /dev/dsk/c0t6 dev_cdrom.so cdrom0'
# get the new 'use floppy ...' line
# ensure that default floppy line is up to date
'use floppy drive /dev/diskette dev_floppy.so floppy0'
# get the new 'use rmscsi ...' line
# ensure that default floppy line is up to date
'# there is no old rmscsi line'
# update the volmissing line (if it hasn't changed)
# update the action lines
# ensure that the label_dos and label_sun lines are current
# ensure unsafe line has udfs
# replace "rmscsi" with "rmdisk" everywhere in the file
# add the new "remount" lines
# restore permissions if they changed
# clean up
fi
done
exit 0