rootfs: optional root directory parameter
authorTimo Savola <tsavola@movial.fi>
Fri, 18 Jul 2008 08:08:31 +0000 (11:08 +0300)
committerTimo Savola <tsavola@movial.fi>
Fri, 18 Jul 2008 08:08:31 +0000 (11:08 +0300)
overrides any path set in config files.  target name will always be unset
if root path is specified on the command-line.

matrix/rootfs.py

index 519ab8b..0f7323f 100644 (file)
@@ -24,7 +24,7 @@ def main():
        def append_config_dir(option, opt, value, parser):
                config.initial_config_dirs.append(value)
 
-       parser = optparse.OptionParser(usage='%prog [<options>]')
+       parser = optparse.OptionParser(usage='%prog [<options>] [<root>]')
 
        parser.add_option(
                '-c', '--config-dir', metavar='DIR',
@@ -61,13 +61,17 @@ def main():
                dest='devrootfs_only', action='store_true')
 
        opts, args = parser.parse_args()
-       if args:
+       if len(args) > 1:
                parser.print_help()
                sys.exit(1)
 
        config_parse('main')
        config_parse('rootfs')
 
+       if args:
+               rootfs.path = args[0]
+               rootfs.target = None
+
        build = Builder(rootfs.path, rootfs.target)
        build.include_paths(rootfs.include_paths)
        build.include_files(rootfs.include_files)