checkvers revision 1.1
11.1Serh#!/bin/ksh 21.1Serh# 31.1Serh# Copyright (c) 1998 The NetBSD Foundation, Inc. 41.1Serh# All rights reserved. 51.1Serh# 61.1Serh# This code is derived from software contributed to The NetBSD Foundation 71.1Serh# by Eric Haszlakiewicz. 81.1Serh# 91.1Serh# Redistribution and use in source and binary forms, with or without 101.1Serh# modification, are permitted provided that the following conditions 111.1Serh# are met: 121.1Serh# 1. Redistributions of source code must retain the above copyright 131.1Serh# notice, this list of conditions and the following disclaimer. 141.1Serh# 2. Redistributions in binary form must reproduce the above copyright 151.1Serh# notice, this list of conditions and the following disclaimer in the 161.1Serh# documentation and/or other materials provided with the distribution. 171.1Serh# 3. All advertising materials mentioning features or use of this software 181.1Serh# must display the following acknowledgement: 191.1Serh# This product includes software developed by the NetBSD 201.1Serh# Foundation, Inc. and its contributors. 211.1Serh# 4. Neither the name of The NetBSD Foundation nor the names of its 221.1Serh# contributors may be used to endorse or promote products derived 231.1Serh# from this software without specific prior written permission. 241.1Serh# 251.1Serh# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 261.1Serh# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 271.1Serh# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 281.1Serh# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 291.1Serh# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 301.1Serh# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 311.1Serh# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 321.1Serh# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 331.1Serh# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 341.1Serh# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 351.1Serh# POSSIBILITY OF SUCH DAMAGE. 361.1Serh# 371.1Serh 381.1Serh#--------------------------------------------------------------------# 391.1Serh# checkvers [-q] [systemlibdir [library name]] 401.1Serh# 411.1Serh# This is a wrapper script around checkver. It will find 421.1Serh# all directories withing the current directory containing 431.1Serh# a shlib_version file and call checkver for each. 441.1Serh# 451.1Serh# As with checkver, a list of directories of installed libraries 461.1Serh# may be specified. This will replace the default of "/usr/lib" 471.1Serh# and search there instead. 481.1Serh# 491.1Serh# A library name may also be specified. However, this script 501.1Serh# will not work correctly if it finds shlib_version files 511.1Serh# corresponding to a different library. 521.1Serh# 531.1Serh# This script produces no output if all library version are ok. 541.1Serh# If the versions aren't ok the header will be displayed once 551.1Serh# followed by a list of problematic libraries. 561.1Serh# 571.1Serh 581.1SerhTMP=/tmp/check.$$ 591.1Serherror=0 601.1Serh 611.1Serh# Cleanup on exit. 621.1Serhtrap "exit 1" 1 2 3 4 5 6 7 8 10 11 12 13 14 15 631.1Serhtrap "rm -rf $TMP" 0 641.1Serh 651.1SerhUsage ( ) { 661.1Serh echo "$1 [-q] [installedlibdir [library name]]" 671.1Serh} 681.1Serh 691.1Serhif echo "$*" | 701.1Serh egrep -q '([[:space:]]|^)-h([[:space:]]|$)|([[:space:]]|^)--help*' ; then 711.1Serh Usage $0 721.1Serh exit 0 731.1Serhfi 741.1Serh 751.1Serhif [ "X$1" = "X-q" ] ; then 761.1Serh # Supress header. 771.1Serh QUIET="-q" 781.1Serh shift 791.1Serhelse 801.1Serh QUIET= 811.1Serhfi 821.1Serh 831.1Serhif [ "X$1" != "X" ] ; then 841.1Serh LIBDIR="$1" 851.1Serhelse 861.1Serh LIBDIR="/usr/lib" 871.1Serhfi 881.1Serhif [ "X$2" != "X" ] ; then 891.1Serh LIBNAME="$2" 901.1Serhelse 911.1Serh LIBNAME= 921.1Serhfi 931.1Serh 941.1Serhif ! mkdir -m 700 $TMP ; then 951.1Serh echo "Unable to create temp directory." 961.1Serh exit 1 971.1Serhfi 981.1Serh 991.1SerhEXECDIR=`eval "(cd \`dirname $0\` ; pwd)"` 1001.1Serh 1011.1SerhCWD=`pwd` 1021.1SerhVERFILES=`find $CWD -name shlib_version -print` 1031.1Serh 1041.1Serhfor f in $VERFILES ; do 1051.1Serh 1061.1Serh (cd `dirname $f` ; 1071.1Serh "$EXECDIR"/checkver $QUIET "$LIBDIR" "$LIBNAME" ; 1081.1Serh exit $?) 1091.1Serh if [ $? -ne 0 ] ; then 1101.1Serh QUIET="-q" 1111.1Serh error=1 1121.1Serh fi 1131.1Serh 1141.1Serh if [ "X$LIBNAME" = "X" ] ; then 1151.1Serh # Build the library name from the directory it's in. 1161.1Serh libname=`dirname $f` 1171.1Serh libname=`basename $libname` 1181.1Serh if ! echo $libname | grep -q "^lib" ; then 1191.1Serh libname="lib$libname" 1201.1Serh fi 1211.1Serh else 1221.1Serh libname="$LIBNAME" 1231.1Serh fi 1241.1Serh 1251.1Serh if [ -e $TMP/$libname ] ; then 1261.1Serh echo "Warning: $libname sources encountered multiple times." 1271.1Serh echo " Previous location: `cat $TMP/$libname`" 1281.1Serh echo " Current location: `dirname $f`" 1291.1Serh fi 1301.1Serh echo "`dirname $f`" > $TMP/$libname 1311.1Serh 1321.1Serhdone 1331.1Serh 1341.1Serhexit 0 135