#!/bin/sh
# SUNWolrtx 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 [ ! -f /usr/openwin/lib/Xinitrc.SUNWolrtx ] && [ -f /usr/openwin/lib/Xinitrc ]; then
	echo "Preserving existing Xinitrc file..."
	/usr/bin/cp -p /usr/openwin/lib/Xinitrc /usr/openwin/lib/Xinitrc.SUNWolrtx
	echo "Changing olwm to olvwm in /usr/openwin/lib/Xinitrc..."
	/usr/bin/sed -e 's/\<olwm\> -syncpid/olvwm -syncpid/' < /usr/openwin/lib/Xinitrc.SUNWolrtx > /usr/openwin/lib/Xinitrc
	/usr/bin/chmod 644 /usr/openwin/lib/Xinitrc
fi

if [ ! -f /usr/openwin/lib/Xdefaults.SUNWolrtx ] && [ -f /usr/openwin/lib/Xdefaults ]; then
	echo "Preserving existing Xdefaults file..."
	/usr/bin/cp -p /usr/openwin/lib/Xdefaults /usr/openwin/lib/Xdefaults.SUNWolrtx
	echo "Editing Xdefaults..."
ed /usr/openwin/lib/Xdefaults >/dev/null 2>&1 <<EOF
a
OpenWindows.Beep:				never
OpenWindows.SelectDisplaysMenu:			False
OpenWindows.SnapToGrid:				True
OpenWindows.AutoReReadMenuFile:			True
OpenWindows.DragWindow:				True
OpenWindows.ShowMoveGeometry:			True
OpenWindows.ShowResizeGeometry:			True
OpenWindows.FocusLenience:			True
OpenWindows.DragWindow:				False
OpenWindows.KeyboardCommands:			Full
OpenWindows.Use3DFrames:			True
OpenWindows.SnapToGrid:				True
OpenWindows.EdgeMoveThreshold:			50
olvwm.VirtualDesktop:				3x2
olvwm.UseImages:				UseAll
.
w
q
EOF

fi
