i.powerconf revision 7c478bd95313f5f23a4c958a745db2134aa03244
#!/bin/sh
#
# 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
# 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
#
#
#pragma ident "%Z%%M% %I% %E% SMI"
#
# Copyright (c) 1996-2001 by Sun Microsystems, Inc.
# All rights reserved.
#
#
PATH="/usr/bin:/usr/sbin:${PATH}" export PATH
write_sed_script()
{
cat > /tmp/power.sed.$$ << EOF
/^#ident.*$/d
/^# Putting an entry in this file will only be effective if the driver$/d
/^# for the device supports device power management. After the file is$/d
/^# modified, pmconfig(1M) command must be executed to activate the new$/d
/^# change.$/d
/^# Fields must be separated by white space or semicolons$/d
/^# Note that physical dependents are automatically considered$/d
/^# by the power management framework.$/d
/^# Name[ ][ ]*.*$/d
/\/dev\/kbd/d
/\/dev\/mouse/d
/^# NOTE: The entries below are only used when no window system is running.$/d
/^# When running the window system, monitor power management is done$/d
/^# by the screen saver functions.$/d
/^# NOTE: The entries below are only used when no windowing environment$/d
/^# NOTE: The entry below is only used when no windowing environment$/d
/^# is running. When running windowing environment, monitor power$/d
/^# management is controlled by the Screen Saver functions.$/d
/^# management is controlled by the window system.$/d
EOF
}
while read src dest
do
if [ ! -f $dest ] ; then
cp $src $dest
else
grep '@(#)power.conf' $src > /tmp/p.$$
write_sed_script
sed -f /tmp/power.sed.$$ < $dest >> /tmp/p.$$
cp -f /tmp/p.$$ $dest
rm -f /tmp/power.sed.$$ /tmp/p.$$
grep -w 'autopm' $dest > /dev/null 2>&1
if [ $? != 0 ]; then
grep -w 'autopm' $src >> $dest
fi
grep -w 'device-dependency-property' $dest > /dev/null 2>&1
if [ $? != 0 ]; then
grep -w 'device-dependency-property' $src >> $dest
fi
fi
done
exit 0