#!/usr/bin/python
# Copyright 2006, CRIM, Revolution Linux Inc.
#
# $Id$
#
# Authors : Francis Giraldeau <francis.giraldeau@revolutionlinux.com>
#
# This file is part of the MILLE-XTERM project.
#
#               http://www.revolutionlinux.com/mille-xterm/
#               http://www.mille.ca/
#
# This program is covered by the GNU General Public License.
# See the COPYING file in the top-level MILLE-XTERM directory.
#
# -------------------------------------------------------------------------

import os, sys
import string
try : from mxapp import autoconfig
except : import autoconfig

def autoconfigure():
	autoconfig.main()


def usage(switches):
	print __doc__
	s = "usage : " + sys.argv[0] + " [ " + string.join(switches.keys()," | ") + " ]\n\n"
	for i in switches.keys():
		s += "\t " + i + "  :\t" + switches[i] + "\n"
	print s

if __name__ == "__main__":

	# Verify that we are root
	if os.getuid() != 0:
		print ("Please restart %s with root permissions!") % (sys.argv[0])
		sys.exit(10)

	# Possibles options : build_all, build_initrd, build_xtermroot
	switches = {"autoconfigure":"Configure automaticaly parameters for the application server"}

	# FIXME : should handle args better
	if len(sys.argv)>1:
		if sys.argv[1] in switches.keys():
			eval(sys.argv[1])()
		else : 
			print usage(switches)
	else : 
		print usage(switches)
		

