xref: /titanic_44/usr/src/tools/scripts/checkproto.sh (revision e14c2a4a501d4977100945042c7372c094adea91)
17c478bd9Sstevel@tonic-gate#!/bin/ksh -e
27c478bd9Sstevel@tonic-gate#
37c478bd9Sstevel@tonic-gate# CDDL HEADER START
47c478bd9Sstevel@tonic-gate#
57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6*e14c2a4aSkupfer# Common Development and Distribution License (the "License").
7*e14c2a4aSkupfer# You may not use this file except in compliance with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
227c478bd9Sstevel@tonic-gate#
23*e14c2a4aSkupfer# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate#
287c478bd9Sstevel@tonic-gateMACH=`uname -p`
297c478bd9Sstevel@tonic-gatePLIST=/tmp/protolist.$$
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gateusage() {
327c478bd9Sstevel@tonic-gate	echo "usage: $0 <workspace>"
337c478bd9Sstevel@tonic-gate	exit 1
347c478bd9Sstevel@tonic-gate}
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gateOPTIND=1
377c478bd9Sstevel@tonic-gatewhile getopts X flag
387c478bd9Sstevel@tonic-gatedo
397c478bd9Sstevel@tonic-gate	case $flag in
407c478bd9Sstevel@tonic-gate	*)	usage
417c478bd9Sstevel@tonic-gate		;;
427c478bd9Sstevel@tonic-gate	esac
437c478bd9Sstevel@tonic-gatedone
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gateshift `expr $OPTIND - 1`
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gateif [ $# = 0 -a "${CODEMGR_WS}" != "" ]; then
487c478bd9Sstevel@tonic-gate	WS=${CODEMGR_WS}
497c478bd9Sstevel@tonic-gateelif [ $# -ne 1 ]; then
507c478bd9Sstevel@tonic-gate	usage
517c478bd9Sstevel@tonic-gateelse
527c478bd9Sstevel@tonic-gate	WS=$1
537c478bd9Sstevel@tonic-gatefi
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gate
567c478bd9Sstevel@tonic-gateGUFLAG="-gu"
577c478bd9Sstevel@tonic-gateif [ "${NIGHTLY_OPTIONS%o*}" != "$NIGHTLY_OPTIONS" ]; then
587c478bd9Sstevel@tonic-gate	GUFLAG=
597c478bd9Sstevel@tonic-gatefi
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gateif [ ! -d ${WS} ]; then
627c478bd9Sstevel@tonic-gate	echo "${WS} is not a workspace"
637c478bd9Sstevel@tonic-gate	exit 1
647c478bd9Sstevel@tonic-gatefi
657c478bd9Sstevel@tonic-gate
667c478bd9Sstevel@tonic-gateif [ -z "${SRC}" ]; then
677c478bd9Sstevel@tonic-gate	SRC=${WS}/usr/src
687c478bd9Sstevel@tonic-gatefi
697c478bd9Sstevel@tonic-gate
707c478bd9Sstevel@tonic-gatePROTO=${WS}/proto/root_${MACH}
717c478bd9Sstevel@tonic-gate
727c478bd9Sstevel@tonic-gaterm -f $PLIST
737c478bd9Sstevel@tonic-gate
74*e14c2a4aSkupferpkglocns="${SRC}/pkgdefs"
75*e14c2a4aSkupfer[ -d ${SRC}/../closed/pkgdefs ] && pkglocns="$pkglocns ${SRC}/../closed/pkgdefs"
76*e14c2a4aSkupfer
77*e14c2a4aSkupferexceptions=""
78*e14c2a4aSkupferpkgdefs=""
79*e14c2a4aSkupferfor p in $pkglocns; do
80*e14c2a4aSkupfer	efile="$p/etc/exception_list_${MACH}"
81*e14c2a4aSkupfer	[ -f $efile ] && exceptions="$exceptions -e $efile"
82*e14c2a4aSkupfer	pkgdefs="$pkgdefs -d $p"
83*e14c2a4aSkupferdone
847c478bd9Sstevel@tonic-gate
857c478bd9Sstevel@tonic-gateprotolist ${PROTO} > $PLIST
86*e14c2a4aSkupferprotocmp ${GUFLAG} $exceptions $pkgdefs ${PLIST}
877c478bd9Sstevel@tonic-gate
887c478bd9Sstevel@tonic-gaterm -f $PLIST
89