13028939bScgd#!/bin/sh 2*99410184Ssalo# $NetBSD: bumpversion,v 1.10 2003/07/26 19:24:24 salo Exp $ 33028939bScgd# 43028939bScgd# Copyright (c) 1993 Christopher G. Demetriou 53028939bScgd# All rights reserved. 63028939bScgd# 73028939bScgd# Redistribution and use in source and binary forms, with or without 83028939bScgd# modification, are permitted provided that the following conditions 93028939bScgd# are met: 103028939bScgd# 1. Redistributions of source code must retain the above copyright 113028939bScgd# notice, this list of conditions and the following disclaimer. 123028939bScgd# 2. Redistributions in binary form must reproduce the above copyright 133028939bScgd# notice, this list of conditions and the following disclaimer in the 143028939bScgd# documentation and/or other materials provided with the distribution. 153028939bScgd# 3. All advertising materials mentioning features or use of this software 163028939bScgd# must display the following acknowledgement: 17db755e7cScgd# This product includes software developed for the 18*99410184Ssalo# NetBSD Project. See http://www.NetBSD.org/ for 19db755e7cScgd# information about NetBSD. 203028939bScgd# 4. The name of the author may not be used to endorse or promote products 21db755e7cScgd# derived from this software without specific prior written permission. 223028939bScgd# 233028939bScgd# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 243028939bScgd# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 253028939bScgd# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 263028939bScgd# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 273028939bScgd# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 283028939bScgd# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 293028939bScgd# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 303028939bScgd# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 313028939bScgd# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 323028939bScgd# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33db755e7cScgd# 34db755e7cScgd# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>> 353028939bScgd 363028939bScgdwhile : 373028939bScgd do case "$1" in 383028939bScgd # -c says to create new shlib_version files 393028939bScgd -c) 403028939bScgd create=TRUE 413028939bScgd shift ;; 423028939bScgd 433028939bScgd # -n sets 'do nothing mode' 443028939bScgd -n) 453028939bScgd donothing=TRUE 463028939bScgd shift ;; 473028939bScgd 483028939bScgd # -m says to bump major number, rather than minor number 493028939bScgd -m) 503028939bScgd bumpmajor=TRUE 513028939bScgd shift ;; 523028939bScgd 533028939bScgd *) 543028939bScgd break ;; 553028939bScgd esac 563028939bScgddone 573028939bScgd 583028939bScgdif [ $# = 0 ] ; then 5959a1661aScgd echo "usage: $0 [-c] [-m] [-n] dir ..." 603028939bScgd exit 2 613028939bScgdfi 623028939bScgd 633028939bScgdTMP=/tmp/bump$$ 643028939bScgderror=0 653028939bScgd 663028939bScgdtrap 'rm -f $TMP ; exit 1' 1 2 3 13 15 673028939bScgd 683028939bScgdfor dir in $@ ; do 693028939bScgd versf=$dir/shlib_version 703028939bScgd 713028939bScgd if [ "X$create" != "X" ] ; then 723028939bScgd if [ ! -d $dir ] ; then 733028939bScgd echo $0: $dir is not a directory 1>&2 743028939bScgd error=1 753028939bScgd continue 763028939bScgd fi 773028939bScgd if [ -e $versf ] ; then 783028939bScgd echo $0: $versf exists\; not replacing 1>&2 793028939bScgd error=1 803028939bScgd continue 813028939bScgd fi 823028939bScgd else 833028939bScgd if [ ! -e $versf ] ; then 843028939bScgd echo $0: $versf does not exist 1>&2 853028939bScgd error=1 863028939bScgd continue 873028939bScgd fi 883028939bScgd if [ ! -f $versf ] ; then 893028939bScgd echo $0: $versf is not a regular file 1>&2 903028939bScgd error=1 913028939bScgd continue 923028939bScgd fi 933028939bScgd if [ ! -r $versf ] ; then 943028939bScgd echo $0: $versf is not readable 1>&2 953028939bScgd error=1 963028939bScgd continue 973028939bScgd fi 983028939bScgd if [ ! -w $versf ] ; then 993028939bScgd echo $0: $versf is not a writable 1>&2 1003028939bScgd error=1 1013028939bScgd continue 1023028939bScgd fi 1033028939bScgd 1043028939bScgd . $versf 1053028939bScgd fi 1063028939bScgd 1073028939bScgd if [ "X$create" != "X" ] ; then 1083028939bScgd nmajor=0 1093028939bScgd nminor=0 1103028939bScgd elif [ "X$bumpmajor" != "X" ] ; then 1113028939bScgd nmajor=`expr $major + 1` 1123028939bScgd nminor=0 1133028939bScgd else 1143028939bScgd nmajor=$major 1153028939bScgd nminor=`expr $minor + 1` 1163028939bScgd fi 1173028939bScgd 1183028939bScgd if [ "X$donothing" = "X" ] ; then 1193028939bScgd echo major=$nmajor > $TMP 1203028939bScgd echo minor=$nminor >> $TMP 1213028939bScgd mv $TMP $versf 1223028939bScgd else 1233028939bScgd echo "$0: $versf -> $nmajor.$nminor" 1243028939bScgd fi 1253028939bScgddone 1263028939bScgd 1273028939bScgdexit $error 128