From 53b0a794ba360f9bb7bb1a24f26e12e23c30f953 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Sat, 4 Oct 2008 19:06:21 -1000 Subject: [PATCH] Add -c option to allow user to specify confdir. Default to /etc/lorax, but let the -c or --confdir= option override that. --- TODO | 2 -- lorax | 13 ++++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 98114fe1..d323f9a9 100644 --- a/TODO +++ b/TODO @@ -4,6 +4,4 @@ - Need a Makefile of some sort -- Allow a confdir override for lorax on the command line - - Hook lorax up to pungi diff --git a/lorax b/lorax index ca9cbdb6..e58fb610 100755 --- a/lorax +++ b/lorax @@ -39,7 +39,8 @@ def usage(prog): print(" -t, --variant=STRING Variant name.") print(" -b, --bugurl=URL Bug reporting URL for the product.") print(" -u, --updates=PATHSPEC Path to find updated RPMS.") - print(" -m, --mirrorlist=REPO Mirror list repo, may be listed multiple times.\n") + print(" -m, --mirrorlist=REPO Mirror list repo, may be listed multiple times.") + print(" -c, --confdir=PATHSPEC Path to config files (default: /etc/lorax).\n") print("A 'REPO' specification is a valid yum repository path.\n") print("See the man page lorax(8) for more information.") @@ -52,10 +53,11 @@ if __name__ == "__main__": bugurl = 'your distribution provided bug reporting tool.' try: - opts, args = getopt.getopt(sys.argv[1:], "v:p:r:o:dt:b:u:m:V", + opts, args = getopt.getopt(sys.argv[1:], "v:p:r:o:dt:b:u:m:c:V", ["version=", "product=", "release=", "output=", "debug", "variant=", - "bugurl=", "updates=", "mirrorlist="]) + "bugurl=", "updates=", "mirrorlist=", + "confdir="]) except getopt.GetoptError: usage(prog) sys.exit(1) @@ -79,6 +81,11 @@ if __name__ == "__main__": updates = a elif o in ('-m', '--mirrorlist'): mirrorlist.append(a) + elif o in ('-c', '--confdir'): + if os.path.isdir(a): + pylorax.conf['confdir'] = a + else: + sys.stderr.write("ERROR: %s is not a directory.\n" % (a,)) elif o in ('-V'): pylorax.show_version(prog) sys.exit(0)