paul@21 | 1 | #!/bin/sh |
paul@21 | 2 | |
paul@21 | 3 | # Filter sections of a complete definition. |
paul@21 | 4 | # |
paul@21 | 5 | # Copyright (C) 2019 Paul Boddie <paul@boddie.org.uk> |
paul@21 | 6 | # |
paul@21 | 7 | # This program is free software; you can redistribute it and/or modify it under |
paul@21 | 8 | # the terms of the GNU General Public License as published by the Free Software |
paul@21 | 9 | # Foundation; either version 3 of the License, or (at your option) any later |
paul@21 | 10 | # version. |
paul@21 | 11 | # |
paul@21 | 12 | # This program is distributed in the hope that it will be useful, but WITHOUT |
paul@21 | 13 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@21 | 14 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@21 | 15 | # details. |
paul@21 | 16 | # |
paul@21 | 17 | # You should have received a copy of the GNU General Public License along with |
paul@21 | 18 | # this program. If not, see <http://www.gnu.org/licenses/>. |
paul@21 | 19 | |
paul@21 | 20 | PROGNAME=`basename "$0"` |
paul@21 | 21 | THISDIR=`dirname "$0"` |
paul@21 | 22 | |
paul@21 | 23 | COMMON="$THISDIR/makesd-common" |
paul@21 | 24 | |
paul@21 | 25 | . "$COMMON" |
paul@21 | 26 | |
paul@21 | 27 | |
paul@21 | 28 | |
paul@21 | 29 | # Obtain the requested system name. |
paul@21 | 30 | |
paul@21 | 31 | TYPE=$1 |
paul@21 | 32 | |
paul@21 | 33 | if [ ! "$TYPE" ] || [ "$TYPE" = '--help' ] ; then |
paul@21 | 34 | cat 1>&2 <<EOF |
paul@21 | 35 | Usage: $PROGNAME <type> [ <property> ... ] |
paul@21 | 36 | |
paul@21 | 37 | Select sections of the given type from a complete description of a system |
paul@21 | 38 | provided on standard input. If any properties are given, select only those |
paul@21 | 39 | properties in the selected sections. |
paul@21 | 40 | EOF |
paul@21 | 41 | exit 1 |
paul@21 | 42 | fi |
paul@21 | 43 | |
paul@21 | 44 | # Select sections of the given type, filtering out all other sections. |
paul@21 | 45 | |
paul@21 | 46 | filter $* |
paul@21 | 47 | exit $? |