i.bootenvrc revision 7c478bd95313f5f23a4c958a745db2134aa03244
0N/A#!/bin/sh
0N/A#
0N/A# CDDL HEADER START
0N/A#
0N/A# The contents of this file are subject to the terms of the
0N/A# Common Development and Distribution License, Version 1.0 only
0N/A# (the "License"). You may not use this file except in compliance
0N/A# with the License.
0N/A#
0N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0N/A# or http://www.opensolaris.org/os/licensing.
0N/A# See the License for the specific language governing permissions
0N/A# and limitations under the License.
0N/A#
0N/A# When distributing Covered Code, include this CDDL HEADER in each
0N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0N/A# If applicable, add the following below this CDDL HEADER, with the
0N/A# fields enclosed by brackets "[]" replaced with your own identifying
873N/A# information: Portions Copyright [yyyy] [name of copyright owner]
0N/A#
0N/A# CDDL HEADER END
0N/A#
0N/A#
0N/A#ident "%Z%%M% %I% %E% SMI"
868N/A#
0N/A# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
0N/A# Use is subject to license terms.
0N/A#
0N/Awhile read src dest
0N/Ado
0N/A if [ ! -f $dest ] ; then
0N/A # Initial installation
1618N/A cp $src $dest
0N/A else
0N/A #
0N/A # Preserve the installed version of
0N/A # /boot/solaris/bootenv.rc during upgrade
338N/A #
338N/A # Try to merge all properties added by the user to
0N/A # the new version
0N/A #
0N/A # Any obsolete properties should be removed explicitly
0N/A # here:-
0N/A # Remove target-driver-for-* property setting since
0N/A # it is no longer relevant to GRUB based boot.
0N/A #
0N/A # Remove auto-boot?, bshfirst, and other realmode related
0N/A # properties.
0N/A #
0N/A # If "setprop boot-file kernel/unix" is found, remove it
0N/A # to permit autobooting 32/64-bit
0N/A #
0N/A # Also, if any conflicts found between the installed and
0N/A # the new version, use the one in the installed version
0N/A #
0N/A
0N/A merge=/tmp/bootenvrc.merge.$$
0N/A tmpdst=/tmp/bootenvrc.dst.$$
0N/A
0N/A #
0N/A # should REMOVE all obsolete setprop here before the merge
0N/A #
0N/A egrep -v "^setprop[ ]+target-driver-for-
1618N/A^setprop[ ]+boot-file[ ]+['\"]?/?kernel/unix['\"]?[ ]*$
0N/A^setprop[ ]+auto-boot
1618N/A^setprop[ ]+boottimeout[ ]
0N/A^setprop[ ]+bshfirst[ ]
0N/A^setprop[ ]+pciide[ ]
0N/A^setprop[ ]+prealloc-chunk-size[ ]" $dest > $tmpdst
0N/A
0N/A cp $src $merge
0N/A
0N/A grep "^setprop" $tmpdst | while read line
0N/A do
0N/A # If prop is new (not in $dest), add it.
0N/A #
0N/A prop=`echo $line | /usr/bin/nawk '{print $2}'`
0N/A result=`grep "[ ]$prop[ ]" $merge`
0N/A if [ $? != 0 ] ; then
0N/A echo $line >> $merge
0N/A continue
0N/A fi
0N/A
0N/A # If the values differ, take the installed one ($dest)
0N/A #
0N/A dstval=`echo $line | /usr/bin/nawk '{print $3}'`
0N/A srcval=`echo $result | /usr/bin/nawk '{print $3}'`
0N/A if [ "$srcval" != "$dstval" ] ; then
0N/A grep -v "$result" $merge > $merge.tmp
0N/A cp $merge.tmp $merge
0N/A rm $merge.tmp
0N/A echo $line >> $merge
0N/A fi
0N/A done
0N/A
0N/A #
0N/A # copy the merged file to $dest
0N/A #
0N/A cp $merge $dest
0N/A rm -f $tmpdst $merge
0N/A fi
0N/Adone
0N/Aexit 0
0N/A