1 #!/bin/sh 2 # 3 # CDDL HEADER START 4 # 5 # The contents of this file are subject to the terms of the 6 # Common Development and Distribution License (the "License"). 7 # You may not use this file except in compliance with the License. 8 # 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 # or http://www.opensolaris.org/os/licensing. 11 # See the License for the specific language governing permissions 12 # and limitations under the License. 13 # 14 # When distributing Covered Code, include this CDDL HEADER in each 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 # If applicable, add the following below this CDDL HEADER, with the 17 # fields enclosed by brackets "[]" replaced with your own identifying 18 # information: Portions Copyright [yyyy] [name of copyright owner] 19 # 20 # CDDL HEADER END 21 # 22 # 23 #pragma ident "%Z%%M% %I% %E% SMI" 24 # 25 # Copyright 2008 Sun Microsystems, Inc. All rights reserved. 26 # Use is subject to license terms. 27 # 28 # 29 30 PATH="/usr/bin:/usr/sbin:${PATH}" export PATH 31 32 write_sed_script() 33 { 34 cat > /tmp/power.sed.$$ << EOF 35 /^# Putting an entry in this file will only be effective if the driver$/d 36 /^# for the device supports device power management. After the file is$/d 37 /^# modified, pmconfig(1M) command must be executed to activate the new$/d 38 /^# change.$/d 39 /^# Fields must be separated by white space or semicolons$/d 40 /^# Note that physical dependents are automatically considered$/d 41 /^# by the power management framework.$/d 42 /^# Name[ ][ ]*.*$/d 43 /\/dev\/kbd/d 44 /\/dev\/mouse/d 45 /^# NOTE: The entries below are only used when no window system is running.$/d 46 /^# When running the window system, monitor power management is done$/d 47 /^# by the screen saver functions.$/d 48 /^# NOTE: The entries below are only used when no windowing environment$/d 49 /^# NOTE: The entry below is only used when no windowing environment$/d 50 /^# is running. When running windowing environment, monitor power$/d 51 /^# management is controlled by the Screen Saver functions.$/d 52 /^# management is controlled by the window system.$/d 53 EOF 54 } 55 56 while read src dest 57 do 58 if [ ! -f $dest ] ; then 59 cp $src $dest 60 else 61 write_sed_script 62 sed -f /tmp/power.sed.$$ < $dest > /tmp/p.$$ 63 cp -f /tmp/p.$$ $dest 64 rm -f /tmp/power.sed.$$ /tmp/p.$$ 65 grep -w 'autopm' $dest > /dev/null 2>&1 66 if [ $? != 0 ]; then 67 grep -w 'autopm' $src >> $dest 68 fi 69 grep -w 'device-dependency-property' $dest > /dev/null 2>&1 70 if [ $? != 0 ]; then 71 grep -w 'device-dependency-property' $src >> $dest 72 fi 73 fi 74 done 75 76 exit 0 77