#!/bin/bash
# Global bashrc file for Debathena machines

export HOSTTYPE="`/bin/machtype`"
export ATHENA_SYS=`/bin/machtype -S`
export ATHENA_SYS_COMPAT=`/bin/machtype -C`
if [ -z "$ATHENA_SYS" ]; then
    export ATHENA_SYS=@sys
fi

renew () {
    principal=`klist -5 2>/dev/null | sed -n 's/^Default principal: // p'`
    KINIT_ARGS=""
    kinit -4 </dev/null &>/dev/null
    [ $? != 3 ] && KINIT_ARGS="-54"
    kinit $KINIT_ARGS "${principal:-$ATHENA_USER}" || return $?
    DEBATHENA_AKLOG="aklog -c athena.mit.edu -p $HOME"
    [ -x /bin/fsid ] && DEBATHENA_AKLOG="fsid -a"
    [ -e /afs/athena.mit.edu ] && $DEBATHENA_AKLOG || {
	ret=$?
	echo >&2
	echo "Your AFS client does not seem to be working.  To troubleshoot this problem," >&2
	echo "visit http://debathena.mit.edu/troubleshooting#openafs-modules" >&2
	return $ret
    }
}

add_flags=
add () { eval "$( /bin/attach -Padd -b $add_flags "$@" )" ; }
