Home | History | Annotate | Download | only in SUNWonbld
      1 #
      2 # CDDL HEADER START
      3 #
      4 # The contents of this file are subject to the terms of the
      5 # Common Development and Distribution License (the "License").
      6 # You may not use this file except in compliance with the License.
      7 #
      8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9 # or http://www.opensolaris.org/os/licensing.
     10 # See the License for the specific language governing permissions
     11 # and limitations under the License.
     12 #
     13 # When distributing Covered Code, include this CDDL HEADER in each
     14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15 # If applicable, add the following below this CDDL HEADER, with the
     16 # fields enclosed by brackets "[]" replaced with your own identifying
     17 # information: Portions Copyright [yyyy] [name of copyright owner]
     18 #
     19 # CDDL HEADER END
     20 #
     21 #
     22 # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
     23 # Use is subject to license terms.
     24 #
     25 #ident	"%Z%%M%	%I%	%E% SMI"
     26 
     27 LC_ALL=C
     28 export LC_ALL
     29 
     30 # Add the 'gk' account with the same password as root
     31 grep gk $BASEDIR/etc/passwd >/dev/null 2>&1
     32 if [ "$?" != "0" ]; then
     33 	echo "Installing 'gk' account"
     34 	echo "gk:x:0:1:Gatekeeper:/opt/onbld/gk:/usr/bin/csh" \
     35 	    >> $BASEDIR/etc/passwd
     36 	grep "^root:" $BASEDIR/etc/shadow | sed -e 's/^root:/gk:/' \
     37 	    >> $BASEDIR/etc/shadow
     38 fi
     39 
     40 # Back up gk's existing .make.machines file
     41 if [ "(" -f $BASEDIR/opt/onbld/gk/.make.machines ")" -a "!" "(" -f \
     42     $BASEDIR/opt/onbld/gk/.make.machines.orig ")" ]; then
     43 	echo "Backing up $BASEDIR/opt/onbld/gk/.make.machines" \
     44 		"to $BASEDIR/opt/onbld/gk/.make.machines.orig";
     45 	cp $BASEDIR/opt/onbld/gk/.make.machines \
     46 		$BASEDIR/opt/onbld/gk/.make.machines.orig;
     47 fi
     48 
     49 # Back up root's existing .make.machines file
     50 if [ "(" -f $BASEDIR/.make.machines ")" -a "!" "(" -f \
     51     $BASEDIR/.make.machines.orig ")" ]; then
     52 	echo "Backing up $BASEDIR/.make.machines to" \
     53 		"$BASEDIR/.make.machines.orig";
     54 	mv $BASEDIR/.make.machines \
     55 		$BASEDIR/.make.machines.orig;
     56 fi
     57 
     58 # Create a .make.machines file for dmake.  Preserve concurrency setting
     59 # for the local machine if present.
     60 grep `uname -n` $BASEDIR/opt/onbld/gk/.make.machines >/dev/null 2>&1;
     61 if [ "$?" = "0" ]; then
     62 	echo "Preserving existing dmake concurrency.";
     63 	grep `uname -n` $BASEDIR/opt/onbld/gk/.make.machines \
     64 		> /tmp/.make.machines;
     65 	mv /tmp/.make.machines $BASEDIR/opt/onbld/gk/.make.machines;
     66 else
     67 	cpus=`psrinfo | grep on-line | wc -l`;
     68 	max=`expr '(' $cpus + 1 ')' '*' 2`;
     69 	speed=`psrinfo -v | head -3 | awk '/MHz/ { print $6 }'`;
     70 	if [ $speed -gt "500" ]; then
     71 		max=`expr $max '*' 2`;
     72 	fi
     73 	echo "`uname -n` max=$max" > $BASEDIR/opt/onbld/gk/.make.machines;
     74 	echo "dmake concurrency set to $max.";
     75 fi
     76 
     77 # Create link for root's .make.machines.
     78 cd $BASEDIR ;
     79 ln -s opt/onbld/gk/.make.machines .make.machines >/dev/null 2>&1 ;
     80 exit 0 ;
     81