# # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (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 # or http://www.opensolaris.org/os/licensing. # 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 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #pragma ident "%Z%%M% %I% %E% SMI" # SVCADM="/usr/sbin/svcadm" SVCCFG="/usr/sbin/svccfg" SVCPROP="/bin/svcprop" PG="config" RCAP_CONF="${PKG_INSTALL_ROOT}/etc/rcap.conf" RCAP_FMRI="svc:/system/rcap:default" PROFILE_UPGRADE="${PKG_INSTALL_ROOT}/var/svc/profile/upgrade" # # If appropriate, enable this service. If /etc/rcap.conf exists, # migrate the existing configuration values regardless of whether # or not rcapd was enabled. # BASEPREFIX=`echo $BASEDIR | tr '/' '_'` FILENAME=`echo sunwrcapr"$BASEPREFIX" | cut -c 1-256` TMPFILE=/tmp/$FILENAME if [ -f $TMPFILE ]; then echo "$SVCADM enable $RCAP_FMRI" >> $PROFILE_UPGRADE rm $TMPFILE fi # # Reads existing configuration values in /etc/rcap.conf and puts # them in repository upon reboot(via /var/svc/profile/upgrade). # migrate_rcap_conf() { pressure=`awk '$1 == "RCAPD_MEMORY_CAP_ENFORCEMENT_PRESSURE" \ && NF == 3 {print $3}' $RCAP_CONF` reconfig_int=`awk '$1 == "RCAPD_RECONFIGURATION_INTERVAL" \ && NF == 3 {print $3}' $RCAP_CONF` walk_int=`awk '$1 == "RCAPD_PROC_WALK_INTERVAL" && \ NF == 3 {print $3}' $RCAP_CONF` report_int=`awk '$1 == "RCAPD_REPORT_INTERVAL" && \ NF == 3 {print $3}' $RCAP_CONF` rss_sample_int=`awk '$1 == "RCAPD_RSS_SAMPLE_INTERVAL" && \ NF == 3 {print $3}' $RCAP_CONF` # Update default configuration values with # pre-existing values # echo "# Migrating pre-existing rcap configuration" >> $PROFILE_UPGRADE if [ -n "$pressure" ]; then echo "$SVCCFG -s $RCAP_FMRI setprop ${PG}/pressure = " \ "$pressure" >> $PROFILE_UPGRADE fi if [ -n "$reconfig_int" ]; then echo "$SVCCFG -s $RCAP_FMRI setprop ${PG}/reconfig_interval = " \ "$reconfig_int" >> $PROFILE_UPGRADE fi if [ -n "$walk_int" ]; then echo "$SVCCFG -s $RCAP_FMRI setprop ${PG}/walk_interval = " \ "$walk_int" >> $PROFILE_UPGRADE fi if [ -n "$report_int" ]; then echo "$SVCCFG -s $RCAP_FMRI setprop ${PG}/report_interval = " \ "$report_int" >> $PROFILE_UPGRADE fi if [ -n "$rss_sample_int" ]; then echo "$SVCCFG -s $RCAP_FMRI setprop ${PG}/rss_sample_interval = " \ "$rss_sample_int" >> $PROFILE_UPGRADE fi echo "$SVCADM refresh $RCAP_FMRI" >> $PROFILE_UPGRADE echo "rm /etc/rcap.conf" >> $PROFILE_UPGRADE } if [ -f $RCAP_CONF ]; then migrate_rcap_conf fi