#! /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=falsefor 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 PF9if test "x$PF9" = x; then if pwd | grep /src > /dev/null; then PF9=`pwd | sed 's,/src.*,,'` else PF9=`pwd` fifiif 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 \ objtypeelse 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 1ficat <<EOFPF=$PF9cputype=$cputypeobjtype=$objtype--EOFcpusys=`cat $PF9/$cputype/sysname`PATH=$PF9/$cpusys/bin:$PF9/$cputype/bin:$PATHshell=$SHELLif echo $shell | grep 'rc$' > /dev/null; then shell=rcfiexec $shell
#! /bin/sh
# there must be a plan9port installation present
if test "x$PLAN9" = x; then
echo PLAN9 variable not set >&2
exit 1
fi
# check that PATH does not contain settings that might
# cause problems
hasbin=false
hasusrbin=false
hasinfernobin=false
hasplan9bin=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
;;
esac
done
if $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`
fi
fi
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 >&2
Not able to find the base directory. Please either move into
the sys/src hierarchy or into the base directory
and re-run $0.
EOF
exit 1
fi
cat <<EOF
PF=$PF9
cputype=$cputype
objtype=$objtype
--
EOF
cpusys=`cat $PF9/$cputype/sysname`
PATH=$PF9/$cpusys/bin:$PF9/$cputype/bin:$PATH
shell=$SHELL
if echo $shell | grep 'rc$' > /dev/null; then
shell=rc
fi
exec $shell