7178657 text-mode-menu should determine whether enabling/disabling localized output
authorKaren Tung <Karen.Tung@oracle.com>
Sat, 30 Jun 2012 00:24:39 -0700
changeset 1739 11d9283b07f7
parent 1738 ad410601d71a
child 1740 d7def37a0301
7178657 text-mode-menu should determine whether enabling/disabling localized output
usr/src/cmd/text-install/svc/Makefile
usr/src/cmd/text-install/svc/getconsole
usr/src/cmd/text-install/svc/text-mode-menu.ksh
usr/src/pkg/manifests/system-install-text-install.mf
--- a/usr/src/cmd/text-install/svc/Makefile	Fri Jun 29 20:45:21 2012 -0600
+++ b/usr/src/cmd/text-install/svc/Makefile	Sat Jun 30 00:24:39 2012 -0700
@@ -41,6 +41,9 @@
 SYSMANIFESTSRC= text-mode-menu.xml
 SYSMANIFESTS= $(SYSMANIFESTSRC:%=$(ROOTMANSYS)/%)
 
+FILES=		getconsole
+FILEMODE=	555
+
 .KEEP_STATE:
 
 all:	$(PROG) $(POFILE)
@@ -51,7 +54,8 @@
 clobber: clean
 
 install: all .WAIT $(ROOTPROGS) $(ROOTMSGS) \
-	 $(ROOTMANSYS) $(ROOTLIBSVCMETHOD) $(SYSMANIFESTS)
+	 $(ROOTMANSYS) $(ROOTLIBSVCMETHOD) $(SYSMANIFESTS) \
+         $(ROOTUSRLIBINSTALL) $(ROOTUSRLIBINSTALLFILES)
 
 $(PROG):	$(PROG_KSH)
 	cp $(PROG_KSH) $(PROG)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/text-install/svc/getconsole	Sat Jun 30 00:24:39 2012 -0700
@@ -0,0 +1,55 @@
+#!/usr/bin/python2.6
+#
+# 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 (c) 2012, Oracle and/or its affiliates. All rights reserved.
+#
+
+    
+'''
+This program calls the get_console() function, prints the console type as
+a string and returns integer return codes based on the console type.  
+
+It prints the console type as well as returns an integer indicating the
+console type to provide flexibility so its callers to either do string
+comparisons with the printed string or compare the return code.
+
+The following integers are returned.
+
+    0: serial console
+    1: physical console
+    2: unknown
+'''
+
+import sys
+
+from solaris_install.getconsole import get_console, SERIAL_CONSOLE, \
+    PHYSICAL_CONSOLE
+
+if __name__ == '__main__':
+
+    console_type = get_console()
+    print "Running from " + console_type
+    if console_type is SERIAL_CONSOLE:
+        sys.exit(0)
+    elif console_type is PHYSICAL_CONSOLE:
+        sys.exit(1)
+    else:
+        sys.exit(2)
--- a/usr/src/cmd/text-install/svc/text-mode-menu.ksh	Fri Jun 29 20:45:21 2012 -0600
+++ b/usr/src/cmd/text-install/svc/text-mode-menu.ksh	Sat Jun 30 00:24:39 2012 -0700
@@ -42,6 +42,13 @@
 	ROOT_SHELL="/usr/bin/sh"
 fi
 
+# Determine whether this program is running from serial console or not.
+# Localized messages are only displayed when running from serial console.
+/usr/lib/install/getconsole > /dev/null 2>& 1
+if [[ $? != 0 ]]; then
+	export LC_MESSAGES=C
+fi
+
 # Define the menu of commands and prompts
 menu_items=( \
     (menu_str=`gettext "Install Oracle Solaris"`			 \
--- a/usr/src/pkg/manifests/system-install-text-install.mf	Fri Jun 29 20:45:21 2012 -0600
+++ b/usr/src/pkg/manifests/system-install-text-install.mf	Sat Jun 30 00:24:39 2012 -0700
@@ -23,33 +23,28 @@
 #
 
 set name=pkg.fmri value=pkg:/system/install/text-install@$(PKGVERS)
+set name=pkg.summary value="Solaris Text Installer"
 set name=pkg.description \
     value="Text Installer libraries, commands, and data files"
-set name=pkg.summary value="Solaris Text Installer"
 set name=info.classification \
     value="org.opensolaris.category.2008:System/Administration and Configuration"
 set name=variant.arch value=$(ARCH)
 set name=variant.opensolaris.zone value=global
-dir path=lib
-dir path=lib/svc
-dir path=lib/svc/manifest group=sys
-dir path=lib/svc/manifest/system group=sys
-dir path=usr group=sys
-dir path=usr/bin
-dir path=usr/lib
-dir path=usr/lib/python2.6
-dir path=usr/lib/python2.6/vendor-packages
-dir path=usr/lib/python2.6/vendor-packages/solaris_install/
-dir path=usr/lib/python2.6/vendor-packages/solaris_install/text_install
-dir path=usr/sbin
-dir path=usr/share group=sys
-dir path=usr/share/text-install group=sys
-dir path=usr/share/text-install/help group=sys
-dir path=usr/share/text-install/help/C group=sys
-dir path=var group=sys
-dir path=var/svc group=sys
+dir  path=lib
+dir  path=lib/svc
+dir  path=lib/svc/manifest group=sys
+dir  path=lib/svc/manifest/system group=sys
 file path=lib/svc/manifest/system/text-mode-menu.xml group=sys mode=0444
+dir  path=usr group=sys
+dir  path=usr/bin
 file path=usr/bin/text-install group=sys mode=0555
+dir  path=usr/lib
+dir  path=usr/lib/install
+file path=usr/lib/install/getconsole mode=0555
+dir  path=usr/lib/python2.6
+dir  path=usr/lib/python2.6/vendor-packages
+dir  path=usr/lib/python2.6/vendor-packages/solaris_install/
+dir  path=usr/lib/python2.6/vendor-packages/solaris_install/text_install
 file \
     path=usr/lib/python2.6/vendor-packages/solaris_install/text_install/__init__.py \
     mode=0444
@@ -152,7 +147,12 @@
 file \
     path=usr/lib/python2.6/vendor-packages/solaris_install/text_install/welcome.pyc \
     mode=0444
+dir  path=usr/sbin
 file path=usr/sbin/text-mode-menu mode=0555
+dir  path=usr/share group=sys
+dir  path=usr/share/text-install group=sys
+dir  path=usr/share/text-install/help group=sys
+dir  path=usr/share/text-install/help/C group=sys
 file path=usr/share/text-install/help/C/discovery_selection.txt group=sys
 file path=usr/share/text-install/help/C/disks.txt group=sys
 file path=usr/share/text-install/help/C/gpt_partitions.txt group=sys
@@ -168,5 +168,7 @@
     group=sys
 file path=usr/share/text-install/help/C/x86_fdisk_slices.txt group=sys
 file path=usr/share/text-install/help/C/x86_fdisk_slices_select.txt group=sys
+dir  path=var group=sys
+dir  path=var/svc group=sys
 license cr_Sun license=cr_Sun
-depend fmri=system/install/locale type=require
+depend type=require fmri=system/install/locale