postinstall revision d75e6a5d480f559280524b60d52730c76a25524f
4896N/A#
4896N/A# CDDL HEADER START
4896N/A#
4896N/A# The contents of this file are subject to the terms of the
4896N/A# Common Development and Distribution License (the "License").
4896N/A# You may not use this file except in compliance with the License.
4896N/A#
4896N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
6983N/A# or http://www.opensolaris.org/os/licensing.
6983N/A# See the License for the specific language governing permissions
4896N/A# and limitations under the License.
4896N/A#
4896N/A# When distributing Covered Code, include this CDDL HEADER in each
4896N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
6983N/A# If applicable, add the following below this CDDL HEADER, with the
6983N/A# fields enclosed by brackets "[]" replaced with your own identifying
6983N/A# information: Portions Copyright [yyyy] [name of copyright owner]
6983N/A#
4896N/A# CDDL HEADER END
4896N/A#
4896N/A#
4896N/A# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
4896N/A# Use is subject to license terms.
5079N/A#
5410N/A#pragma ident "%Z%%M% %I% %E% SMI"
4896N/A#
4896N/A
4896N/ASVCADM="/usr/sbin/svcadm"
4896N/ASVCCFG="/usr/sbin/svccfg"
4896N/ASVCPROP="/bin/svcprop"
4896N/APG="config"
4896N/ARCAP_CONF="${PKG_INSTALL_ROOT}/etc/rcap.conf"
4896N/ARCAP_FMRI="svc:/system/rcap:default"
4896N/APROFILE_UPGRADE="${PKG_INSTALL_ROOT}/var/svc/profile/upgrade"
4896N/A
4896N/A#
4896N/A# If appropriate, enable this service. If /etc/rcap.conf exists,
4896N/A# migrate the existing configuration values regardless of whether
4896N/A# or not rcapd was enabled.
4896N/A#
4896N/ABASEPREFIX=`echo $BASEDIR | tr '/' '_'`
4896N/AFILENAME=`echo sunwrcapr"$BASEPREFIX" | cut -c 1-256`
4896N/ATMPFILE=/tmp/$FILENAME
4896N/Aif [ -f $TMPFILE ]; then
4896N/A echo "$SVCADM enable $RCAP_FMRI" >> $PROFILE_UPGRADE
4896N/A
4896N/A rm $TMPFILE
4896N/Afi
4896N/A
5410N/A#
5410N/A# Reads existing configuration values in /etc/rcap.conf and puts
4896N/A# them in repository upon reboot(via /var/svc/profile/upgrade).
4896N/A#
4896N/Amigrate_rcap_conf()
4896N/A{
4896N/A pressure=`awk '$1 == "RCAPD_MEMORY_CAP_ENFORCEMENT_PRESSURE" \
4896N/A && NF == 3 {print $3}' $RCAP_CONF`
4896N/A
4896N/A reconfig_int=`awk '$1 == "RCAPD_RECONFIGURATION_INTERVAL" \
4896N/A && NF == 3 {print $3}' $RCAP_CONF`
5410N/A
4896N/A walk_int=`awk '$1 == "RCAPD_PROC_WALK_INTERVAL" && \
4896N/A NF == 3 {print $3}' $RCAP_CONF`
5410N/A
5410N/A report_int=`awk '$1 == "RCAPD_REPORT_INTERVAL" && \
5410N/A NF == 3 {print $3}' $RCAP_CONF`
4896N/A
4896N/A rss_sample_int=`awk '$1 == "RCAPD_RSS_SAMPLE_INTERVAL" && \
4896N/A NF == 3 {print $3}' $RCAP_CONF`
4896N/A
4896N/A # Update default configuration values with
4896N/A # pre-existing values
4896N/A #
4896N/A echo "# Migrating pre-existing rcap configuration" >> $PROFILE_UPGRADE
4896N/A
4896N/A if [ -n "$pressure" ]; then
4896N/A echo "$SVCCFG -s $RCAP_FMRI setprop ${PG}/pressure = " \
4896N/A "$pressure" >> $PROFILE_UPGRADE
4896N/A fi
4896N/A
4896N/A if [ -n "$reconfig_int" ]; then
4896N/A echo "$SVCCFG -s $RCAP_FMRI setprop ${PG}/reconfig_interval = " \
4896N/A "$reconfig_int" >> $PROFILE_UPGRADE
4896N/A fi
4896N/A
4896N/A if [ -n "$walk_int" ]; then
4896N/A echo "$SVCCFG -s $RCAP_FMRI setprop ${PG}/walk_interval = " \
4896N/A "$walk_int" >> $PROFILE_UPGRADE
4896N/A fi
4896N/A
4896N/A if [ -n "$report_int" ]; then
5410N/A echo "$SVCCFG -s $RCAP_FMRI setprop ${PG}/report_interval = " \
5410N/A "$report_int" >> $PROFILE_UPGRADE
5410N/A fi
4896N/A
4896N/A if [ -n "$rss_sample_int" ]; then
4896N/A echo "$SVCCFG -s $RCAP_FMRI setprop ${PG}/rss_sample_interval = " \
4896N/A "$rss_sample_int" >> $PROFILE_UPGRADE
4896N/A fi
4896N/A
4896N/A echo "$SVCADM refresh $RCAP_FMRI" >> $PROFILE_UPGRADE
4896N/A echo "rm /etc/rcap.conf" >> $PROFILE_UPGRADE
4896N/A}
4896N/A
5079N/Aif [ -f $RCAP_CONF ]; then
5079N/A migrate_rcap_conf
5079N/Afi
5079N/A