2 # $NetBSD: checkvers,v 1.6 2000/08/09 23:41:27 gmcgarry Exp $
4 # Copyright (c) 1998 The NetBSD Foundation, Inc.
7 # This code is derived from software contributed to The NetBSD Foundation
8 # by Eric Haszlakiewicz.
10 # Redistribution and use in source and binary forms, with or without
11 # modification, are permitted provided that the following conditions
13 # 1. Redistributions of source code must retain the above copyright
14 # notice, this list of conditions and the following disclaimer.
15 # 2. Redistributions in binary form must reproduce the above copyright
16 # notice, this list of conditions and the following disclaimer in the
17 # documentation and/or other materials provided with the distribution.
19 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
32 #--------------------------------------------------------------------#
33 # checkvers [-q] [systemlibdir [library name]]
35 # This is a wrapper script around checkver. It will find
36 # all directories withing the current directory containing
37 # a shlib_version file and call checkver for each.
39 # As with checkver, a list of directories of installed libraries
40 # may be specified. This will replace the default of "/usr/lib"
41 # and search there instead.
43 # A library name may also be specified. However, this script
44 # will not work correctly if it finds shlib_version files
45 # corresponding to a different library.
47 # This script produces no output if all library version are ok.
48 # If the versions aren't ok the header will be displayed once
49 # followed by a list of problematic libraries.
53 # if "-s", build list, pass with -f to checkver.
54 # if "-d", build list, pass with -f to checkver.
55 # if "-f", pass with -f to checkver.
60 trap "exit 2" 1 2 3 4 5 6 7 8 10 11 12 13 14 15
64 echo "Usage: $1 [-q] -d [installedlibdir [library name]]"
65 echo " $1 [-q] -s [setlistdir [library name]]"
66 echo " $1 [-q] -f liblistfile [library name]"
70 setsdir
=$basedir/distrib
/sets
/lists
79 args
=`getopt "df:shq" "$@"`
80 if [ $?
-ne 0 ] ; then
90 if [ $usefile -eq 1 -o $usesets -eq 1 ]; then
93 -f) usefile
=1 ; arg1
=$2 ; shift ; shift
94 if [ $usedir -eq 1 -o $usesets -eq 1 ]; then
98 if [ $usedir -eq 1 -o $usefile -eq 1 ]; then
101 -h) Usage
$0 ; exit 0;;
102 -q) quiet
=1 ; shift;;
107 if [ $usedir -eq 0 -a $usefile -eq 0 -a $usesets -eq 0 ] ; then
110 if [ $usefile -eq 0 -a $# -gt 2 ] ; then
113 if [ $usefile -eq 1 -a $# -gt 1 ] ; then
117 #-------------------------#
123 if [ quiet
-eq 1 ] ; then
127 if ! mkdir
-m 700 $TMP ; then
128 echo "$0: Unable to create temp directory."
132 if [ $usefile -eq 1 ] ; then
133 # Just pass the file name to checkver.
136 LIBLIST
=$TMP/libs.lst
139 # Build list from the installed libraries.
140 if [ $usedir -eq 1 ] ; then
141 if [ "X$1" != "X" ] ; then
144 for f
in $libdir ; do
146 done > $LIBLIST 2> /dev
/null
149 # Build list from set lists. Parameter may be either
150 # the "lists" directory or the top of the source tree.
151 if [ $usesets -eq 1 ] ; then
152 if [ "X$1" != "X" ] ; then
154 if [ -d "$setsdir/distrib/sets/lists" ] ; then
155 setsdir
="$setsdir/distrib/sets/lists"
159 cat */[a-z
]* |
grep '^./usr/lib/lib.*\.so\.[0-9][0-9]*\.[0-9][0-9]*' \
164 if [ "X$2" != "X" ] ; then
168 EXECDIR
=`eval "(cd \`dirname $0\
` ; pwd)"`
171 VERFILES
=`find $CWD -name shlib_version -print`
173 for f
in $VERFILES ; do
174 # Call checkver. We always have a list of libraries
175 # here, whether given to us or built, so always
178 "sh $EXECDIR"/checkver
$QUIET -f "$LIBLIST" "$LIBNAME" ;
181 if [ $ERR -eq 2 ] ; then
182 echo "$0: checkver failed. LIBLIST=$LIBLIST $LIBNAME=$LIBNAME"
185 if [ $ERR -ne 0 ] ; then
190 if [ "X$LIBNAME" = "X" ] ; then
191 # Build the library name from the directory it's in.
193 libname
=`basename $libname`
194 if ! echo $libname |
grep -q "^lib" ; then
195 libname
="lib$libname"
201 if [ -e $TMP/$libname ] ; then
202 echo "Warning: $libname sources encountered multiple times."
203 echo " Previous location: `cat $TMP/$libname`"
204 echo " Current location: `dirname $f`"
206 echo "`dirname $f`" > $TMP/$libname