xref: /titanic_41/usr/src/cmd/netadm/etc/ttydefs.cleanup.sh (revision 1d925b368c0579a57acb90e1e8db63c3a5613790)
1*1d925b36Smcwalter#!/bin/sh
2*1d925b36Smcwalter#
3*1d925b36Smcwalter# CDDL HEADER START
4*1d925b36Smcwalter#
5*1d925b36Smcwalter# The contents of this file are subject to the terms of the
6*1d925b36Smcwalter# Common Development and Distribution License (the "License").
7*1d925b36Smcwalter# You may not use this file except in compliance with the License.
8*1d925b36Smcwalter#
9*1d925b36Smcwalter# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*1d925b36Smcwalter# or http://www.opensolaris.org/os/licensing.
11*1d925b36Smcwalter# See the License for the specific language governing permissions
12*1d925b36Smcwalter# and limitations under the License.
13*1d925b36Smcwalter#
14*1d925b36Smcwalter# When distributing Covered Code, include this CDDL HEADER in each
15*1d925b36Smcwalter# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*1d925b36Smcwalter# If applicable, add the following below this CDDL HEADER, with the
17*1d925b36Smcwalter# fields enclosed by brackets "[]" replaced with your own identifying
18*1d925b36Smcwalter# information: Portions Copyright [yyyy] [name of copyright owner]
19*1d925b36Smcwalter#
20*1d925b36Smcwalter# CDDL HEADER END
21*1d925b36Smcwalter#
22*1d925b36Smcwalter#
23*1d925b36Smcwalter# ident	"%Z%%M%	%I%	%E% SMI"
24*1d925b36Smcwalter#
25*1d925b36Smcwalter# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
26*1d925b36Smcwalter# Use is subject to license terms.
27*1d925b36Smcwalter
28*1d925b36SmcwalterTMP=${FLASH_ROOT}/tmp/SUNWcsr.ttydefs.$$
29*1d925b36SmcwalterTTYDEFS_FILE=${FLASH_ROOT}/etc/ttydefs
30*1d925b36Smcwalter
31*1d925b36Smcwalter# If the system is an SPARC-Enterprise system,
32*1d925b36Smcwalter# then the /etc/ttydefs file must include the correct console entry.
33*1d925b36SmcwalterisSparcEnterprise()
34*1d925b36Smcwalter{
35*1d925b36Smcwalter	# Add the crtscts flag for the console settings if needed.
36*1d925b36Smcwalter	if [ ! "`grep '^console:.* crtscts:' ${TTYDEFS_FILE}`" ] ; then
37*1d925b36Smcwalter		sed -e "/^console:.*onlcr:/ {
38*1d925b36Smcwalter			s/onlcr:/onlcr crtscts:/
39*1d925b36Smcwalter			}" ${TTYDEFS_FILE} > ${TMP}
40*1d925b36Smcwalter		# Update the ttydefs file
41*1d925b36Smcwalter		cp ${TMP} ${TTYDEFS_FILE}
42*1d925b36Smcwalter		rm -f ${TMP}
43*1d925b36Smcwalter	fi
44*1d925b36Smcwalter}
45*1d925b36Smcwalter
46*1d925b36Smcwalter# Restore the ttydefs file to the default
47*1d925b36SmcwalterdefaultPlatform()
48*1d925b36Smcwalter{
49*1d925b36Smcwalter	if [ "`grep '^console:.* crtscts:' ${TTYDEFS_FILE}`" ] ; then
50*1d925b36Smcwalter		sed -e "/^console:.* crtscts:/ {
51*1d925b36Smcwalter		s/ crtscts:/:/
52*1d925b36Smcwalter		}" ${TTYDEFS_FILE} > ${TMP}
53*1d925b36Smcwalter		# Update the ttydefs file
54*1d925b36Smcwalter		cp ${TMP} ${TTYDEFS_FILE}
55*1d925b36Smcwalter		rm -f ${TMP}
56*1d925b36Smcwalter	fi
57*1d925b36Smcwalter}
58*1d925b36Smcwalter
59*1d925b36Smcwalter# Determine action for the appropriate system
60*1d925b36SmcwalterPLATFORM_TOKEN=`prtconf -b | awk '/^name:/ { print $2 }'`
61*1d925b36Smcwaltercase "$PLATFORM_TOKEN"
62*1d925b36Smcwalterin
63*1d925b36Smcwalter	SUNW,SPARC-Enterprise)
64*1d925b36Smcwalter		isSparcEnterprise
65*1d925b36Smcwalter		;;
66*1d925b36Smcwalter	*)
67*1d925b36Smcwalter		defaultPlatform
68*1d925b36Smcwalter		;;
69*1d925b36Smcwalteresac
70*1d925b36Smcwalter
71*1d925b36Smcwalterexit 0
72