107 lines · 1.9 KB · Text
RawDownload
#! /bin/sh # there must be a plan9port installation presentif test "x$PLAN9" = x; then	echo PLAN9 variable not set >&2	exit 1fi # check that PATH does not contain settings that might# cause problemshasbin=falsehasusrbin=falsehasinfernobin=falsehasplan9bin=false for p in `echo $PATH | tr ' :' '_ '`; do	case $p in	/usr/bin)		hasusrbin=:		;;	/bin)		hasbin=:		;;	$PLAN9/bin)		if $hasbin && $hasusrbin; then :		else			echo 'Error: $PLAN9/bin in PATH is not behind /bin and /usr/bin, which will cause problems' >&2			exit 1		fi		hasplan9bin=:		;;		*/inferno/*/bin*)		if $hasplan9bin; then :		else			echo 'Error: PATH seems to contain an inferno /bin, that comes before $PLAN9/bin' >&2			echo 'This will cause problems, because of the mk binary.'			exit 1		fi		;;	esacdoneif $hasplan9bin; then :else	echo 'Error: PATH does not contain $PLAN9/bin' >&2	exit 1	fi  # check whether we are inside of a pf9 tree,# and try to guess a value for PF9 if test "x$PF9" = x; then 	if pwd | grep /src > /dev/null; then		PF9=`pwd | sed 's,/src.*,,'`	else		PF9=`pwd`	fifi if test -f "$PF9/pf9.defaults"; then		# derive default value for objtype from cputype	test "$objtype" || objtype=$cputype 	# save them as used-defined settings	user_objtype=$objtype	user_cputype=$cputype 	# load distribution defaults	. $PF9/pf9.defaults 	# user settings have precedence	test -z "$user_objtype" || objtype=$user_objtype	test -z "$user_cputype" || cputype=$user_cputype			export \		PF9 \		cputype \		objtype else	cat <<EOF >&2Not able to find the base directory. Please either move intothe sys/src hierarchy or into the base directoryand re-run $0. EOF	exit 1fi cat <<EOFPF=$PF9cputype=$cputypeobjtype=$objtype--EOF cpusys=`cat  $PF9/$cputype/sysname`PATH=$PF9/$cpusys/bin:$PF9/$cputype/bin:$PATH   shell=$SHELLif echo $shell | grep 'rc$' > /dev/null; then	shell=rcfiexec $shell