#!/usr/bin/python import os,sys,imp,string #This allows plugins (and this code) to import modules in the /modules dir sys.path.append(os.getcwd()+"/modules") from catalyst_support import * def usage(): print "usage: meep!" if len(sys.argv)==1 or sys.argv[1] in ["-h","--help"]: usage() sys.exit(1) import targets targetmap={} targets.register(targetmap) if os.getuid()!=0: #non-root callers can't go any further than here. die("This script requires root privileges to operate.") myspec={} #these would come from /etc/catalyst.conf: myspec["storedir"]="/var/tmp/catalyst" myspec["sharedir"]="/usr/share/catalyst" #these would come from there too?: myspec["distdir"]="/mnt/misc/distfiles" myspec["portdir"]="/usr/portage" myspec["options"]="ccache pkgcache" if "ccache" in string.split(myspec["options"]): print "Compiler cache support enabled." myspec["CCACHE"]="1" if "pkgcache" in string.split(myspec["options"]): print "Package cache support enabled." myspec["PKGCACHE"]="1" #determine target, call target constructor and hand it the rest of the arguments try: addlargs={} arg_parse(myspec,addlargs) if not targetmap.has_key(myspec["target"]): raise CatalystError,"Target \""+myspec["target"]+"\" not available." mytarget=targetmap[myspec["target"]](myspec,addlargs) mytarget.run() except CatalystError: sys.exit(1) # Examples: # ./catalyst subarch=pentium4 version_stamp=20031016 target=stage3 rel_type=default rel_version=1.4 snapshot=20031016 source_subpath=default-x86-1.4/stage2-pentium4-20031016 # ./catalyst target=snapshot version_stamp=20031028