8111f49
#!/bin/sh
8111f49
8111f49
gdmwhich () {
8111f49
  COMMAND="$1"
8111f49
  OUTPUT=
8111f49
  IFS=:
8111f49
  for dir in $PATH
8111f49
  do
8111f49
    if test -x "$dir/$COMMAND" ; then
8111f49
      if test "x$OUTPUT" = "x" ; then
8111f49
        OUTPUT="$dir/$COMMAND"
8111f49
      fi
8111f49
    fi
8111f49
  done
8111f49
  IFS=$OLD_IFS
8111f49
  echo "$OUTPUT"
8111f49
}
8111f49
8111f49
echo
8111f49
echo "GDM Theme Tester"
8111f49
echo
8111f49
echo "Be sure to test all the environments:"
8111f49
echo " console, console-timed, flexi, remote-flexi, xdmcp"
8111f49
echo "Also be sure to test using caps lock"
8111f49
echo
8111f49
8111f49
XNEST=`gdmwhich Xnest`
8111f49
GDMXNEST=`gdmwhich gdmXnest`
8111f49
GDMGREETER="@libexecdir@/gdmgreeter"
8111f49
8111f49
if [ x$XNEST = x ]; then
8111f49
	echo "ERROR: Xnest not found"
8111f49
        echo ""
8111f49
	exit 1
8111f49
fi
8111f49
8111f49
if [ x$GDMXNEST = x ]; then
8111f49
	echo "ERROR: gdmXnest not found"
8111f49
        echo ""
8111f49
	exit 1
8111f49
fi
8111f49
8111f49
if [ x$GDMGREETER = x ]; then
8111f49
	echo "ERROR: gdmgreeter not found"
8111f49
        echo ""
8111f49
	exit 1
8111f49
fi
8111f49
8111f49
USAGE="
8111f49
Usage: $0 <environment> <theme>
8111f49
<environment> is one of: console, console-timed, flexi, remote-flexi, xdmcp
8111f49
<theme> is either the path of the theme or the name of an installed theme
8111f49
8111f49
If you set the environment variable XNESTSIZE to <width>x<height> (e.g. 800x600)
8111f49
you can test the greeter at that resolution
8111f49
"
8111f49
if [ "$#" != 2 ]; then
8111f49
	echo "$USAGE"
8111f49
	exit 1
8111f49
fi
8111f49
8111f49
GDM_THEME="$2"
8111f49
DOING_GDM_DEVELOPMENT=yes
8111f49
GDM_PARENT_DISPLAY="$DISPLAY"
8111f49
export GDM_THEME DOING_GDM_DEVELOPMENT GDM_PARENT_DISPLAY
8111f49
8111f49
case $1 in
8111f49
console)
8111f49
	GDM_IS_LOCAL=yes
8111f49
	export GDM_IS_LOCAL
8111f49
	;;
8111f49
console-timed)
8111f49
	GDM_IS_LOCAL=yes
8111f49
	GDM_FAKE_TIMED=yes
8111f49
	export GDM_IS_LOCAL GDM_FAKE_TIMED
8111f49
	;;
8111f49
flexi)
8111f49
	GDM_IS_LOCAL=yes
8111f49
	GDM_FLEXI_SERVER=yes
8111f49
	export GDM_IS_LOCAL GDM_FLEXI_SERVER
8111f49
	;;
8111f49
remote-flexi)
8111f49
	GDM_FLEXI_SERVER=yes
8111f49
	export GDM_FLEXI_SERVER
8111f49
	;;
8111f49
xdmcp)
8111f49
	;;
8111f49
*)
8111f49
	echo "$USAGE"
8111f49
	exit 1
8111f49
	;;
8111f49
esac
8111f49
8111f49
if [ "x$XNESTSIZE" = x ] ; then
8111f49
  eval `gdmXnest -b`
8111f49
else
8111f49
  eval `gdmXnest -b -o "-geometry $XNESTSIZE"`
8111f49
fi
8111f49
export DISPLAY
8111f49
8111f49
if [ "x$GDM_PARENT_DISPLAY" = "x$DISPLAY" ]; then
8111f49
	echo "ERROR: Can't start the Xnest server"
8111f49
	exit 1
8111f49
fi
8111f49
8111f49
# This may not be necessary
8111f49
sleep 1
8111f49
8111f49
@libexecdir@/gdmgreeter
8111f49