1#!/bin/ksh -p 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23# Use is subject to license terms. 24# 25# ident "%Z%%M% %I% %E% SMI" 26 27# 28# set path, but inherit /tmp/bfubin if it is sane 29# 30if [ "`echo $PATH | cut -f 1 -d :`" = /tmp/bfubin ] && \ 31 [ -O /tmp/bfubin ] ; then 32 export PATH=/tmp/bfubin:/usr/sbin:/usr/bin:/sbin 33else 34 export PATH=/usr/sbin:/usr/bin:/sbin 35fi 36 37usage() { 38 echo "This utility is a component of the bootadm(1M) implementation" 39 echo "and it is not recommended for stand-alone use." 40 echo "Please use bootadm(1M) instead." 41 echo "" 42 echo "Usage: ${0##*/}: [-R \<root\>] [-p \<platform\>] \<filelist\> ..." 43 echo "where \<platform\> is one of i86pc, sun4u or sun4v" 44 exit 2 45} 46 47# default platform is what we're running on 48PLATFORM=`uname -m` 49 50altroot="" 51filelists= 52platform_provided=no 53 54OPTIND=1 55while getopts R:p: FLAG 56do 57 case $FLAG in 58 R) if [ "$OPTARG" != "/" ]; then 59 altroot="$OPTARG" 60 fi 61 ;; 62 p) platform_provided=yes 63 PLATFORM="$OPTARG" 64 ;; 65 *) usage 66 ;; 67 esac 68done 69 70shift `expr $OPTIND - 1` 71if [ $# -eq 0 ]; then 72 usage 73fi 74 75filelists=$* 76 77# 78# If the target platform is provided, as is the case for diskless, 79# or we're building an archive for this machine, we can build 80# a smaller archive by not including unnecessary components. 81# 82filtering=no 83if [ "$altroot" == "" ] || [ $platform_provided = yes ]; then 84 case $PLATFORM in 85 i86pc) 86 filtering=no 87 ;; 88 sun4u) 89 filtering=yes 90 exclude_pattern="sun4v" 91 ;; 92 sun4v) 93 filtering=yes 94 exclude_pattern="sun4u" 95 ;; 96 *) 97 usage 98 ;; 99 esac 100fi 101 102for list in $filelists 103do 104 if [ -f $altroot/$list ]; then 105 if [ $filtering = yes ]; then 106 cat $altroot/$list | grep -v $exclude_pattern 107 else 108 cat $altroot/$list 109 fi 110 fi 111done 112 113exit 0 114