#!/bin/sh
# SUNWoldte on Solaris 9/10 postinstall script.

if [ `/bin/uname -p` = "$ARCH" ] ; then
        EXEC_BASE=$BASEDIR
else
        EXEC_BASE=/
fi
export EXEC_BASE

if [ $EXEC_BASE != "/" ]; then
        LD_LIBRARY_PATH=$EXEC_BASE/usr/openwin/server/lib:$EXEC_BASE/usr/openwin/lib
        export LD_LIBRARY_PATH
fi

if [ ! -x $EXEC_BASE/usr/openwin/bin/mkfontdir ]
then
    # if mkfontdir doesn't exist we cannot proceed
    exit 2
fi

if [ ! -x $EXEC_BASE/usr/openwin/lib/installalias ]
then
    # if installalias doesn't exist we cannot proceed
    exit 2
fi

FONTINSTDIR=$BASEDIR/usr/openwin/lib/X11/fonts/misc
export FONTINSTDIR

if [ ! -f $FONTINSTDIR/fonts.alias ]
then
    # if fonts.alias doesn't exist we cannot proceed
    exit 2
fi

if [ `/bin/grep -cl '^olcursor' $FONTINSTDIR/fonts.alias` -eq 0 ]; then
	cat >> $FONTINSTDIR/fonts.alias << EOF
olcursor   "-sun-open look cursor-----12-120-75-75-p-455-sunolcursor-1"
olcursor-12  olcursor
olglyph    "-sun-open look glyph-----0-0-0-0-p-0-sunolglyph-1"
EOF
	(
		cd $FONTINSTDIR
		$EXEC_BASE/usr/openwin/bin/mkfontdir .
	)
fi

exit 0
