#!/bin/sh
#
admin=/usr/lib/X11/sx/sxadmin
sxmenu=/usr/bin/X11/sxmenu
geometry=

while true
do
	if [ "$1" = "" ]
	then
		break
	elif [ $1 = -geometry ]
	then
		geometry=$2
		shift
	elif [ $1 = -adminPath ]
	then
		cwd=`pwd`
		cd $2
		admin=`pwd`
		cd $cwd
		shift
	elif [ $1 = -sxmenuPath ]
	then
		sxmenu=$2
		shift
	fi
	shift
done
if [ ! -d $admin ]
then
	echo "No directory for sxadmin : $admin"
	echo "usage: sxadmin [-adminPath path] [-sxmenuPath path]"
	exit 1
fi
if [ "$geometry" = "" ]
then
	exec $sxmenu -file $admin/menu.ascii/main -popupName admin -varFile /etc/rc.custom -name 'System_Administration' AdminHome=$admin 
else
	exec $sxmenu -geometry $geometry -file $admin/menu.ascii/main -popupName admin -varFile /etc/rc.custom -name 'System_Administration' AdminHome=$admin 
fi
