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