Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > by-pkgid > 9c31c0ca2451c85a0500455d64c7f0ac > files > 5

xview-3.2p1.4-8mdk.src.rpm

#!/bin/sh
# Start "OpenWindows", i.e. Xfree and ol[v]wm, by K.Osterberg, 1993

export XAPPLRESDIR HELPPATH OPENWINHOME WINDOWMANAGER X11HOME

printerr () {
        echo "`basename $0`: $@" 1>&2
        exit 1
}

printhelp() {
	echo "You can run openwin with the following options:"
	echo "-display	:	Specify display to run on"
	echo "-wm [name]:	Specify window manager to use"
	echo "		Default is olvwm, sane alternative is olwm"
	echo "-help	:	This message"
	echo "All other arguments will be passed to the server"
}

OPENWINHOME="${OPENWINHOME-/usr/openwin}"
if [ ! -d "$OPENWINHOME" ]; then
	printerr "$OPENWINHOME does not exist - cannot run"
fi

X11HOME="${X11HOME-/usr/X11R6}"
if [ ! -d "$X11HOME" ]; then
	printerr "$X11HOME does not exist - cannot run"
fi

if [ -z `echo "$PATH" | grep openwin` ]; then
	PATH=$OPENWINHOME/bin:$PATH
fi

if [ -z "$HELPPATH" ]; then
	HELPPATH=${OPENWINHOME}/lib/help
else
	HELPPATH=$HELPPATH:${OPENWINHOME}/lib/help
fi

if [ -z "$XAPPLRESDIR" ]; then
	XAPPLRESDIR=${X11HOME}/lib/app-defaults
else
	XAPPLRESDIR=$XAPPLRESDIR:${X11HOME}/lib/app-defaults
fi

while [ $# -gt 0 ]; do
	case "$1" in
	-display)
		if [ $# -lt 2 ]; then
				printerr "$1 option requires a display name"
		fi
		shift
		DISPLAY="$1"
		;;
	:*)
		DISPLAY="$1"
		;;
		
	-wm)
		if [ $# -lt 2 ]; then
			printerr "$1 option requires a window manager command"
		fi
		shift
		WINDOWMANAGER="$1"
		;;
	-help)
		printhelp
		exit 1
		;;
	*)
		GIVETOSERVER="$GIVETOSERVER $1"
	esac
	shift
done

if [ -z "$WINDOWMANAGER" ]; then
	WINDOWMANAGER=$OPENWINHOME/bin/olvwm
fi

export DISPLAY WINDOWMANAGER

if [ "x$XDM" = "xrunning" -o "x$DISPLAY" != "x" ]; then
    # X is already running (e.g. this file was called from xdm
    # or they want us to run openwin on another display)
    # so just run openwin's Xinitrc
    exec $OPENWINHOME/lib/Xinitrc
else
    if [ -x $X11HOME/bin/startx ]; then
	exec $X11HOME/bin/startx $OPENWINHOME/lib/Xinitrc -- $GIVETOSERVER
    else
	printerr "Couldn't run $X11HOME/bin/startx"
    fi
fi