1 # Search the specified directory (parameter $1) for the specified items (the
2 # remaining parameters). The "item" is expected to be a directory located
3 # somewhere along the directory tree at which $1 points. This directory must
4 # have exactly 1 subdirectory and that subdirectory's name is considered to
5 # be the version number we are looking for.
7 # This tool searches for these items in the order specified and emits the
8 # first version number it finds. Using an one-line shell script for this task
9 # turned out to be pretty impossible as the algorithm is quite complicated
10 # (the "items" may move around the directory tree between releases and even
11 # some of them might disappear and the others appear) so a full blown utility
18 if test -d $directory; then :; else
19 echo "Path '$directory' does not exist or is not a directory"
22 if test -d $directory/org/opendaylight; then :; else
23 echo "Path '$directory' does not look like OpenDaylight System directory"
26 file_list=`pwd`/filelist.tmp
27 trap "rm -f $file_list" EXIT
32 find . -name $Thing -type d -print >$file_list
34 while read -r directory_to_check; do
35 cd $directory_to_check
36 for file_in_checked_directory in *; do
37 if test -d $file_in_checked_directory; then
38 if test "$version_found" = "n/a"; then
39 version_found=$file_in_checked_directory
40 where_found=$directory_to_check
59 dirname $where_found | cut -b 3-
61 echo "None of the supplied components were found."