# SUNWxwplt (OpenWindows required core package) post install/remove script.


# Link $OPENWINHOME/lib/openwin-menu-demo link to the correct menu file. This
# link is included by the openwin-menu-program menu. If the demos are not
# installed then it points to openwin-menu-demo-nodemo, which contains a short
# message saying that the demos are not installed.  If the demos are installed
# then it points to openwin-menu-demo-fulldemo which contains a list of the
# OpenWindows demos.
#
# See also the SUNWxwdem (OpenWindows demo package) postinstall script.

(   # Run in a subshell to isolate any directory changes.

    if [ -d $BASEDIR/openwin/demo ]; then
	cd    $BASEDIR/openwin/lib
	rm -f $BASEDIR/openwin/lib/openwin-menu-demo
	ln -s openwin-menu-demo-fulldemo openwin-menu-demo
    else 
        cd    $BASEDIR/openwin/lib
        rm -f $BASEDIR/openwin/lib/openwin-menu-demo
        ln -s openwin-menu-demo-nodemo openwin-menu-demo
    fi
)

##machine_arch=`uname -p`
# use $ARCH, this is already set in the postinstall environment and allows correctly
# setting setgid/setuid bit for the X server, when installing x86 packages onto a sparc
# or vice-versa.
#
if [ -f $BASEDIR/openwin/bin/Xsun ]
then
	if [ "$ARCH" = "i386" ]
	then
        	chmod 4775 $BASEDIR/openwin/bin/Xsun
        	installf $PKGINST $BASEDIR/openwin/bin/Xsun f 4775 root bin
	elif [ "$ARCH" = "sparc" ]
	then
        	chmod 2755 $BASEDIR/openwin/bin/Xsun
        	installf $PKGINST $BASEDIR/openwin/bin/Xsun f 2755 root root 
	fi
fi


installf -f $PKGINST || exit 2

exit 0

