#!/bin/sh -login




# mplus directory
export MPLUS_DIR=/mnt/toolbox/mplus_work_space


# resources
if [ -f $MPLUS_DIR/mplus_Xresources ]; then
	xrdb -merge $MPLUS_DIR/mplus_Xresources
fi


# keymaps
if [ -f /usr/X11R6/lib/X11/xinit/Xmodmap ]; then
	xmodmap /usr/X11R6/lib/X11/xinit/Xmodmap
fi


if [ "`which fvwm`" != "" ]; then
	if [ -d $HOME/.mplus ]; then
		if [ -f $HOME/.mplus/mplusrc ]; then
			:
		else
			cp $MPLUS_DIR/mplusrc $HOME/.mplus
		fi
		if [ -f $HOME/.mplus/xinitrc_progs ]; then
			:
		else
			cp $MPLUS_DIR/xinitrc_progs $HOME/.mplus
		fi
	else
		mkdir $HOME/.mplus &&
		cp $MPLUS_DIR/mplusrc $MPLUS_DIR/xinitrc_progs $HOME/.mplus
	fi
	$HOME/.mplus/xinitrc_progs
	$MPLUS_DIR/build_fvwm2rc && exec fvwm2 -f $HOME/.mplus/fvwm2rc_mplus
else
	$HOME/.mplus/xinitrc_progs
	$MPLUS_DIR/mplus_twm/build_twmrc && exec twm -f $HOME/.mplus/twmrc_mplus
fi
