diff options
-rw-r--r-- | usr/src/cmd/power/Makefile | 23 | ||||
-rw-r--r-- | usr/src/cmd/power/sysidpm.po | 68 | ||||
-rw-r--r-- | usr/src/cmd/power/sysidpm.sh | 327 | ||||
-rw-r--r-- | usr/src/pkg/manifests/system-kernel-power.mf | 1 |
4 files changed, 6 insertions, 413 deletions
diff --git a/usr/src/cmd/power/Makefile b/usr/src/cmd/power/Makefile index 3496ab78df..3934605588 100644 --- a/usr/src/cmd/power/Makefile +++ b/usr/src/cmd/power/Makefile @@ -36,9 +36,7 @@ SUSPEND_OBJS = $(SUSPEND_SRCS:%.c=%.o) SUSPEND = sys-suspend SRCS = $(DAEMON_SRCS) $(PMCFG_SRCS) $(SUSPEND_SRCS) OBJS = $(SRCS:%.c=%.o) -SCRIPTS = sysidpm.sh -SYSIDPM = sysidpm -PROG = $(DAEMON) $(PMCFG) $(SYSIDPM) $(SUSPEND) +PROG = $(DAEMON) $(PMCFG) $(SUSPEND) POWERCONF= power.conf ETCFILES = $(POWERCONF) POWERPERM = power @@ -56,9 +54,6 @@ TEXT_DOMAIN= SUNW_OST_OSCMD XGETFLAGS += -a -x power_all.xcl POFILE= power_all.po POFILES= $(PMCFG_SRCS:%.c=%.po) $(SUSPEND_SRCS:%.c=%.po) -# needed because POFILES is deleted by clobber, but it's under -# SCCS control here. -OPOFILES= sysidpm.po # pmconfig only needs libdevinfo on sparc sparc_LDEVINFO= -ldevinfo -lefi -ladm -lzfs -lnvpair @@ -83,9 +78,6 @@ $(ROOTLIBPOWERDAEMON) := FILEMODE= 555 ROOTETCFILES= $(ETCFILES:%=$(ROOTETC)/%) $(ROOTETCFILES) := FILEMODE= 644 -ROOTUSRSBINSYSIDPM= $(SYSIDPM:%=$(ROOTUSRSBIN)/%) -$(ROOTUSRSBINSYSIDPM) := FILEMODE= 755 - # # lint pass one enforcement # @@ -95,7 +87,7 @@ CFLAGS += $(CCVERBOSE) .KEEP_STATE: -all: $(PROG) $(POWERPERM).dfl $(ETCFILES) $(SCRIPTS) +all: $(PROG) $(POWERPERM).dfl $(ETCFILES) install clean: @@ -120,7 +112,7 @@ $(SUSPEND): $(SUSPEND_OBJS) $(POST_PROCESS) install: all $(ROOTUSRSBINPMCFG) $(ROOTLIBPOWERDAEMON) $(ROOTUSRBINSUSPEND) \ - $(ROOTETCFILES) $(ROOTUSRSBINSYSIDPM) $(ROOTETCDEFAULTFILES) \ + $(ROOTETCFILES) $(ROOTETCDEFAULTFILES) \ $(ROOTMANIFEST) $(ROOTSVCMETHOD) $(ROOTLIBPOWER): @@ -131,17 +123,14 @@ $(ROOTLIBPOWER)/%: % $(ROOTLIBPOWERDAEMON): $(ROOTLIBPOWER) -$(OPOFILES): - @ - -$(POFILE): $(POFILES) $(OPOFILES) +$(POFILE): $(POFILES) $(RM) $@ - cat $(POFILES) $(OPOFILES) > $@ + cat $(POFILES) > $@ check: $(CHKMANIFEST) clean: - $(RM) $(OBJS) $(SYSIDPM) $(POWERCONF) + $(RM) $(OBJS) $(POWERCONF) $(RM) $(POFILE) $(POFILES) lint := LINTFLAGS=-auxn diff --git a/usr/src/cmd/power/sysidpm.po b/usr/src/cmd/power/sysidpm.po deleted file mode 100644 index 70ade6e0c4..0000000000 --- a/usr/src/cmd/power/sysidpm.po +++ /dev/null @@ -1,68 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# 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 -# -#ident "%Z%%M% %I% %E% SMI" -# -# TRANSLATION_NOTE: -# These are messages of the sysidpm script -# -# TRANSLATION_NOTE: -# In the following message, each escape sequence requires -# double backslashes to prevent the interpretation by the shell and -# gettext before being passed to ckyorn. -# In the sysidpm.sh script, the corresponding original message has -# three backslashes for each escape sequence. -msgid "\\tAfter 30 minutes of idle time on this system, your system " - "state\\n\\twill automatically be saved to disk, and the system will " - "power-off.\\n\\n\\tLater, when you want to use the system again, and " - "you turn the power\\n\\tback on, your system will be restored to its " - "previous state,\\n\\tincluding all the programs that you were running." - "\\n\\n\\tDo you want this automatic power-saving shutdown?\\n" - "\\t(If this system is used as a server, answer n)" -msgstr -# TRANSLATION_NOTE: -# In the following message, each escape sequence requires -# double backslashes to prevent the interpretation by the shell and -# gettext before being passed to ckyorn. -# In the sysidpm.sh script, the corresponding original message has -# three backslashes for each escape sequence. -msgid "\\tDo you want the system to ask about this again, when you next " - "reboot?\\n\\t(This gives you the chance to try it before deciding " - "whether\\n\\tto keep it.)" -msgstr -msgid "\t================================================================" -msgstr -msgid "\tThis system is configured to conserve energy." -msgstr -msgid "\tAutoshutdown remains enabled." -msgstr -msgid "\tAutoshutdown has been disabled." -msgstr -msgid "\n\tThe system will ask you about automatic shutdown at the next reboot." -msgstr -msgid "\n\tThe system will not ask you again about automatic shutdown." -msgstr -msgid "\n\tThe \"Using Power Management\" AnswerBook describes more about how" - "\n\tto change and set workstation energy-saving features." -msgstr diff --git a/usr/src/cmd/power/sysidpm.sh b/usr/src/cmd/power/sysidpm.sh deleted file mode 100644 index 826f5db2a9..0000000000 --- a/usr/src/cmd/power/sysidpm.sh +++ /dev/null @@ -1,327 +0,0 @@ -#!/bin/sh -# -# 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. -# -# ident "%Z%%M% %I% %E% SMI" - -# The -c and -u options are used by system configruation. -USAGE="$0 [-c|-u]" -TEXTDOMAIN="SUNW_OST_OSCMD" -export TEXTDOMAIN - -# As of Oct. 1, 1995, any new system shipped will have root -# property "energystar-v2" defined in its prom. -ESTAR_PROP="energystar-v2" - -# Power Management configuration file -PWR_CONF=/etc/power.conf -SHUTDOWN_PATTERN="autoshutdown[ ]" -TMP=/var/run/tmp1.$$ - -# If this flag is present, user will be asked the autoshutdown -# question again even when autoshutdown is already configured. -ASK_AGAIN_FLAG=/etc/.PM_RECONFIGURE - -# This is provided for auto-install. -# If either of the files is present, autoshutdown will be configured -# accordingly silently. -SHUTDOWN_ENABLE_FLAG=/autoshutdown -SHUTDOWN_DISABLE_FLAG=/noautoshutdown - -# Autoshutdown is not supported on diskless systems. -IS_DISKLESS="" - -# Default autoshutdown setup. -DEFAULT_IDLE_TIME="30" -DEFAULT_START_TIME="9:00" -DEFAULT_FINISH_TIME="9:00" - -# Currently autoshutdown setup in the configuration file. -CURRENT_IDLE_TIME="" -CURRENT_START_TIME="" -CURRENT_FINISH_TIME="" -CURRENT_BEHAVIOR="" - -# Autoshutdown confirmation message to be prompted in the question1. -# In the following message, each escape sequence requires three -# backslashes to prevent the interpretation by the shell and gettext -# before being passed to ckyorn. In the message catalog, each message -# will have two backslashes. -MSG1=`gettext '\\\tAfter 30 minutes of idle time on this system, your system \ -state\\\n\\\twill automatically be saved to disk, and the system will \ -power-off.\\\n\\\n\\\tLater, when you want to use the system again, and \ -you turn the power\\\n\\\tback on, your system will be restored to its \ -previous state,\\\n\\\tincluding all the programs that you were running.\ -\\\n\\\n\\\tDo you want this automatic power-saving shutdown?\\\n\ -\\\t(If this system is used as a server, answer n)'` - -# Message to be prompted in question2. -# In the following message, each escape sequence requires three -# backslashes to prevent the interpretation by the shell and gettext -# before being passed to ckyorn. In the message catalog, each message -# will have two backslashes. -MSG2=`gettext '\\\tDo you want the system to ask about this again, when \ -you next reboot?\\\n\\\t(This gives you the chance to try it before deciding \ -whether\\\n\\\tto keep it.)'` - -# The autoshutdown comment to be put into the power management config file. -SHUTDOWN_COMMENT="# Auto-Shutdown\t\tIdle(min)\tStart/Finish(hh:mm)\tBehavior" - -# Set up path. -PATH="/usr/bin:/usr/sbin:${PATH}" -export PATH - -# -# Get current autoshutdown setup. -# -get_behavior() { - grep -s "$SHUTDOWN_PATTERN" $PWR_CONF > /dev/null - if [ $? = 0 ]; then - set - `grep "$SHUTDOWN_PATTERN" $PWR_CONF` - CURRENT_IDLE_TIME=$2 - CURRENT_START_TIME=$3 - CURRENT_FINISH_TIME=$4 - CURRENT_BEHAVIOR=$5 - fi -} - -# -# Set the autoshutdown behavior in the configuration file. -# The autoshutdown token can be preceded by spaces. -# The resulting configuration will be based on the first autoshutdown -# line if there is more than one in the configuration file. -# -set_behavior() { - BEHAVIOR="$1" - - grep -s "$SHUTDOWN_PATTERN" $PWR_CONF > /dev/null - if [ $? = 0 ]; then - set - `grep "$SHUTDOWN_PATTERN" $PWR_CONF` - CURRENT_IDLE_TIME=$2 - CURRENT_START_TIME=$3 - CURRENT_FINISH_TIME=$4 - CURRENT_BEHAVIOR=$5 - fi - - if [ "$BEHAVIOR" = "unconfigured" ]; then - IDLE=$DEFAULT_IDLE_TIME - START=$DEFAULT_START_TIME - FINISH=$DEFAULT_FINISH_TIME - else { - if [ "$CURRENT_IDLE_TIME" = "" ]; then - IDLE="$DEFAULT_IDLE_TIME" - else - IDLE="$CURRENT_IDLE_TIME" - fi - - if [ "$CURRENT_START_TIME" = "" ]; then - START="$DEFAULT_START_TIME" - else - START="$CURRENT_START_TIME" - fi - - if [ "$CURRENT_FINISH_TIME" = "" ]; then - FINISH="$DEFAULT_FINISH_TIME" - else - FINISH="$CURRENT_FINISH_TIME" - fi - } fi - - grep -v "# Auto-Shutdown[ ]" $PWR_CONF | grep -v "$SHUTDOWN_PATTERN" > $TMP - echo $SHUTDOWN_COMMENT >> $TMP - echo "autoshutdown\t\t${IDLE}\t\t${START} ${FINISH}\t\t${BEHAVIOR}" >> \ - $TMP - cp $TMP $PWR_CONF - rm $TMP -} - -# -# Print out the Energystar guidelines. -# -print_estar_guidelines() { - echo - echo "`gettext '\t================================================================'`" - echo "`gettext '\tThis system is configured to conserve energy.'`" - echo "`gettext '\t================================================================'`" -} - -# -# Ask user for autoshutdown confirmation. -# -question1() { - ans=`ckyorn -Q -d y -p "$1"` - case $ans in - y|yes|Y|Yes|YES) - set_behavior shutdown - echo - echo "`gettext '\tAutoshutdown remains enabled.'`" - break - ;; - n|no|N|No|NO) - set_behavior noshutdown - echo - echo "`gettext '\tAutoshutdown has been disabled.'`" - break - ;; - esac -} - -# -# Ask user whether they want to be asked about the question again during -# next reboot. -# -question2() { - ans=`ckyorn -Q -d n -p "$1"` - case $ans in - y|yes|Y|Yes|YES) - touch $ASK_AGAIN_FLAG - echo "`gettext '\n\tThe system will ask you about automatic shutdown at the next reboot.'`" - break - ;; - n|no|N|No|NO) - rm -f $ASK_AGAIN_FLAG - echo "`gettext '\n\tThe system will not ask you again about automatic shutdown.'`" - break - ;; - esac -} - - -################ -# Main # -################ - -# -# Exit if /etc/power.conf does not exist or is not writable. -# -if [ ! -f $PWR_CONF -o ! -w $PWR_CONF ]; then - exit 1 -fi - - -# -# Usage: sysidpm [-c|-u] -# -if [ $# -gt 1 ]; then - echo $USAGE - exit 1 -fi - - -# -# The postinstall script of some power management package should have -# added this command into the application list in /etc/.sysidconfig.apps. -# System configuration and unconfiguration will call those applications -# with option -c and -u respectively. -# -if [ $# -eq 1 ]; then - case $1 in - -c) # Does not need to do anything. - exit 0 ;; - -u) - # Reset the behavior back to unconfigured state. - set_behavior unconfigured - - # Remove the statefile line too. - grep -v statefile $PWR_CONF > $TMP - cp $TMP $PWR_CONF - rm $TMP - - exit 0 ;; - *) - echo $USAGE - exit 1 ;; - esac -fi - - -# -# Get current autoshutdown setup. -# -get_behavior - -# -# If this is a diskless system, silently disable autoshutdown and exit. -# -ROOT_FSTYPE=`df -n / | (read w1 w2 w3; echo $w3)` -if [ $ROOT_FSTYPE != "ufs" ]; then - set_behavior noshutdown - exit 0 -fi - - -# -# If /autoshutdown is present, silently enable autoshutdown and exit. -# -if [ -f $SHUTDOWN_ENABLE_FLAG ]; then - set_behavior shutdown - rm $SHUTDOWN_ENABLE_FLAG - exit 0 -fi - -# -# If /noautoshutdown is present, silently disable autoshutdown and -# exit. -# -if [ -f $SHUTDOWN_DISABLE_FLAG ]; then - set_behavior noshutdown - rm $SHUTDOWN_DISABLE_FLAG - exit 0 -fi - - -# -# If this is an EnergyStar compliant system, the default should -# have autoshutdown enabled. However we don't want to surprise -# users, so let's confirm with the user. -# -prtconf -vp | grep -s -w ${ESTAR_PROP} > /dev/null -if [ $? = 0 ]; then - if [ "$CURRENT_BEHAVIOR" = "unconfigured" -o -f $ASK_AGAIN_FLAG ]; then - print_estar_guidelines - question1 "$MSG1" - question2 "$MSG2" - # Currently, we do not have documentation for changing and - # setting workstation energy-saving features. When we do, - # gettext messages should be emitting here. see CR6520924 - # - echo - fi - exit 0 -fi - -# -# The rest of the cases will have 'default' autoshutdown behavior. -# -if [ "$CURRENT_BEHAVIOR" = "unconfigured" ]; then - set_behavior default - exit 0 -fi - -# -# We are here because either the autoshutdown line has been -# removed or the behavior has been configured. It can be a result -# of upgrade. In that case, the configuration file should not -# be changed. Let's exit. -exit 0 diff --git a/usr/src/pkg/manifests/system-kernel-power.mf b/usr/src/pkg/manifests/system-kernel-power.mf index 5aefeeb000..0de41f886d 100644 --- a/usr/src/pkg/manifests/system-kernel-power.mf +++ b/usr/src/pkg/manifests/system-kernel-power.mf @@ -67,7 +67,6 @@ $(i386_ONLY)file path=usr/kernel/drv/pm group=sys file path=usr/kernel/drv/pm.conf group=sys file path=usr/lib/power/powerd mode=0555 file path=usr/sbin/pmconfig mode=4555 -file path=usr/sbin/sysidpm group=sys mode=0755 file path=usr/share/man/man1/sys-suspend.1 file path=usr/share/man/man1m/pmconfig.1m file path=usr/share/man/man1m/powerd.1m |