From: Stephen Rothwell Date: Thu, 27 Aug 2015 23:15:51 +0000 (+1000) Subject: fetch_trees: allow to fetch a subset of trees X-Git-Url: http://git.ozlabs.org/?a=commitdiff_plain;h=7363c0c3aadfaf4dda8bfff3bfd2c3460f5bfa55;p=next-scripts fetch_trees: allow to fetch a subset of trees --- diff --git a/fetch_trees b/fetch_trees index 39f7924..b165bbf 100755 --- a/fetch_trees +++ b/fetch_trees @@ -1,5 +1,15 @@ #!/bin/bash +[ "$1" = "-s" ] && { + shift + start_from="$1" + [ -z "$start_from" ] && { + echo "-s requires a start tree" 1>&2 + exit 1 + } + shift +} + . "$(dirname $0)/common.sh" "" get_field() @@ -83,6 +93,14 @@ trees="$@" trees=$(grep -v '^#' $CTRL_FILE | awk -F '\t' '{ print $3 }') for name in $trees; do + [ -n "$start_from" ] && { + if [ "$name" = "$start_from" ]; then + start_from="" + else + continue + fi + } + type=$(get_field "$name" 2) echo $name: $type