[05d97eef] | 1 | #!/bin/sh
|
---|
| 2 |
|
---|
[c21d4d6] | 3 | #
|
---|
[91ece11b] | 4 | # Copyright (c) 2021 Jiri Svoboda
|
---|
[c21d4d6] | 5 | # Copyright (c) 2019 Jiří Zárevúcky
|
---|
| 6 | # All rights reserved.
|
---|
| 7 | #
|
---|
| 8 | # Redistribution and use in source and binary forms, with or without
|
---|
| 9 | # modification, are permitted provided that the following conditions
|
---|
| 10 | # are met:
|
---|
| 11 | #
|
---|
| 12 | # - Redistributions of source code must retain the above copyright
|
---|
| 13 | # notice, this list of conditions and the following disclaimer.
|
---|
| 14 | # - Redistributions in binary form must reproduce the above copyright
|
---|
| 15 | # notice, this list of conditions and the following disclaimer in the
|
---|
| 16 | # documentation and/or other materials provided with the distribution.
|
---|
| 17 | # - The name of the author may not be used to endorse or promote products
|
---|
| 18 | # derived from this software without specific prior written permission.
|
---|
| 19 | #
|
---|
| 20 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 21 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 22 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 23 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 24 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 25 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 26 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 27 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 28 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 29 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 30 | #
|
---|
| 31 |
|
---|
[05d97eef] | 32 | # Find out the path to the script.
|
---|
| 33 | SOURCE_DIR=`which -- "$0" 2>/dev/null`
|
---|
| 34 | # Maybe we are running bash.
|
---|
| 35 | [ -z "$SOURCE_DIR" ] && SOURCE_DIR=`which -- "$BASH_SOURCE"`
|
---|
| 36 | [ -z "$SOURCE_DIR" ] && exit 1
|
---|
| 37 | SOURCE_DIR=`dirname -- "$SOURCE_DIR"`
|
---|
| 38 | SOURCE_DIR=`cd $SOURCE_DIR && cd .. && echo $PWD`
|
---|
| 39 |
|
---|
| 40 | CONFIG_DEFAULTS="${SOURCE_DIR}/defaults"
|
---|
| 41 |
|
---|
[91ece11b] | 42 | # Find the leaf subdirectories in the defaults directory.
|
---|
| 43 | level1dirs=`ls "$CONFIG_DEFAULTS"`
|
---|
| 44 | for dname in $level1dirs; do
|
---|
| 45 | l2dirs=`ls "$CONFIG_DEFAULTS"/"$dname"`
|
---|
| 46 | havel2=
|
---|
| 47 | for dn in $l2dirs; do
|
---|
| 48 | if [ -d "$CONFIG_DEFAULTS/$dname/$dn" ]; then
|
---|
| 49 | echo "$dname/$dn"
|
---|
| 50 | havel2=true
|
---|
| 51 | fi
|
---|
| 52 | done
|
---|
| 53 | if [ -z "$havel2" ]; then
|
---|
| 54 | echo "$dname"
|
---|
| 55 | fi
|
---|
| 56 | done
|
---|