setup: add section support
[xfstests-dev.git] / setup
1 #!/bin/bash
2 #
3 # Copyright (c) 2003-2004 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License as
7 # published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it would be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write the Free Software Foundation,
16 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 #
18 usage()
19 {
20
21         echo "Usage: $0 [options]"'
22
23         -s section              run only specified section(s) from config file
24 '
25         exit 0
26 }
27
28 while [ $# -gt 0 ]; do
29         case "$1" in
30         -\? | -h | --help) usage ;;
31         -s)     RUN_SECTION="$RUN_SECTION $2"; shift ;;
32         *)      usage ;;
33         esac
34         shift
35 done
36
37 if ! . ./common/config
38 then
39     echo "check: failed to source common/config"
40     exit 1
41 fi
42
43 for section in $HOST_OPTIONS_SECTIONS; do
44         OLD_FSTYP=$FSTYP
45         OLD_MOUNT_OPTIONS=$MOUNT_OPTIONS
46         get_next_config $section
47
48         # Do we need to run only some sections ?
49         if [ ! -z "$RUN_SECTION" ]; then
50                 skip=true
51                 for s in $RUN_SECTION; do
52                         if [ $section == $s ]; then
53                                 skip=false
54                                 break;
55                         fi
56                 done
57                 if $skip; then
58                         continue
59                 fi
60         fi
61
62         [ "$USE_EXTERNAL"    = yes ] || USE_EXTERNAL=no
63         [ "$USE_LBD_PATCH"   = yes ] || USE_LBD_PATCH=no
64         [ "$LARGE_SCRATCH_DEV"  = yes ] || LARGE_SCRATCH_DEV=no
65         [ "$USE_ATTR_SECURE" = yes ] || USE_ATTR_SECURE=no
66         [ -z "$FSTYP" ] && FSTYP="xfs"
67
68         cat <<EOF
69 SECTION       -- $section
70
71 TEST: DIR=$TEST_DIR DEV=$TEST_DEV rt=[$TEST_RTDEV] log=[$TEST_LOGDEV]
72 TAPE: dev=[$TAPE_DEV] rmt=[$RMT_TAPE_DEV] rmtirix=[$RMT_TAPE_USER@$RMT_IRIXTAPE_DEV]
73 SCRATCH: MNT=$SCRATCH_MNT DEV=$SCRATCH_DEV rt=[$SCRATCH_RTDEV] log=[$SCRATCH_LOGDEV]
74 VARIABLES: external=$USE_EXTERNAL largeblk=$USE_LBD_PATCH fstyp=$FSTYP
75            large_scratch_dev=$LARGE_SCRATCH_DEV attrsecure=$USE_ATTR_SECURE
76 --------
77 EOF
78 done