diff --git a/bin/is b/bin/is index 1972768003b9f3581921c912789393c410f4940d..9ec7b2a315af1202252997ca0b1226fabcda2c7c 100755 --- a/bin/is +++ b/bin/is @@ -107,6 +107,11 @@ def c_build(args): ''' for path in args.paths: arrow("Build %s" % path) + # chdir inside path if --chdir + if args.chdir: + cwd = os.getcwdu() + os.chdir(path) + path = "." arrowlevel(1) # build start time t0 = time.time() @@ -119,6 +124,8 @@ def c_build(args): t1 = time.time() dt = int(t1 - t0) arrow(u"Build time: %s" % datetime.timedelta(seconds=dt)) + if args.chdir: + os.chdir(cwd) arrowlevel(-1) def c_cat(args): @@ -456,6 +463,8 @@ def arg_parser_init(): p = subparser.add_parser("build", help=c_build.__doc__.lower()) p.add_argument("-c", "--no-check", action="store_true", help="do not check compilation before adding scripts") + p.add_argument("-C", "--chdir", action="store_true", + help="build image inside source image directory, not in current directory") p.add_argument("-f", "--force", action="store_true", help="rebuild image if already exists") p.add_argument("-p", "--payload", action="store_true", diff --git a/completion/bash/is b/completion/bash/is index 6c78454c57bcbe89a167fad648c1147782bfe63b..926ee76dc7bc2025e15f7927a9591abaaf37231c 100644 --- a/completion/bash/is +++ b/completion/bash/is @@ -70,7 +70,7 @@ _is() { (( args > 2 )) && _filedir '?(u)isimage' ;; build) - [[ "$cur" == -* ]] && _opt '-h --help -f --force -p --payload -c --no-check -s --no-script' && return 0 + [[ "$cur" == -* ]] && _opt '-h --help -f --force -p --payload -c --no-check -s --no-script -C --chdir' && return 0 _count_args (( args >= 2 )) && _filedir -d ;; diff --git a/completion/zsh/_installsystems b/completion/zsh/_installsystems index 4f225758ace5542f80b8045c5e28e969a0616566..54455e5df31e1da5a262ee4362fd2e8d275e9d4e 100644 --- a/completion/zsh/_installsystems +++ b/completion/zsh/_installsystems @@ -130,6 +130,7 @@ _is() { (build) args+=( '(-c --no-check)'{-c,--no-check}'[do not check compilation before adding scripts]' + '(-C --chdir)'{-C,--chdir}'[build image inside source image directory]' '(-f --force)'{-f,--force}'[rebuild image if already exists]' '(-p --payload)'{-p,--payload}'[rebuild payloads if already exists]' '(-s --no-script)'{-s,--no-script}"[doesn't execute build script]"