bumpversion revision 1.2
11.1Scgd#!/bin/sh 21.1Scgd# 31.1Scgd# Copyright (c) 1993 Christopher G. Demetriou 41.1Scgd# All rights reserved. 51.1Scgd# 61.1Scgd# Redistribution and use in source and binary forms, with or without 71.1Scgd# modification, are permitted provided that the following conditions 81.1Scgd# are met: 91.1Scgd# 1. Redistributions of source code must retain the above copyright 101.1Scgd# notice, this list of conditions and the following disclaimer. 111.1Scgd# 2. Redistributions in binary form must reproduce the above copyright 121.1Scgd# notice, this list of conditions and the following disclaimer in the 131.1Scgd# documentation and/or other materials provided with the distribution. 141.1Scgd# 3. All advertising materials mentioning features or use of this software 151.1Scgd# must display the following acknowledgement: 161.1Scgd# This product includes software developed by Christopher G. Demetriou. 171.1Scgd# 4. The name of the author may not be used to endorse or promote products 181.1Scgd# derived from this software withough specific prior written permission 191.1Scgd# 201.1Scgd# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 211.1Scgd# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 221.1Scgd# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 231.1Scgd# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 241.1Scgd# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 251.1Scgd# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 261.1Scgd# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 271.1Scgd# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 281.1Scgd# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 291.1Scgd# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 301.1Scgd# 311.2Scgd# $Id: bumpversion,v 1.2 1993/11/07 11:14:53 cgd Exp $ 321.1Scgd# 331.1Scgd 341.1ScgdPATH=/bin:/usr/bin 351.1Scgdexport PATH 361.1Scgd 371.1Scgdwhile : 381.1Scgd do case "$1" in 391.1Scgd # -c says to create new shlib_version files 401.1Scgd -c) 411.1Scgd create=TRUE 421.1Scgd shift ;; 431.1Scgd 441.1Scgd # -n sets 'do nothing mode' 451.1Scgd -n) 461.1Scgd donothing=TRUE 471.1Scgd shift ;; 481.1Scgd 491.1Scgd # -m says to bump major number, rather than minor number 501.1Scgd -m) 511.1Scgd bumpmajor=TRUE 521.1Scgd shift ;; 531.1Scgd 541.1Scgd *) 551.1Scgd break ;; 561.1Scgd esac 571.1Scgddone 581.1Scgd 591.1Scgdif [ $# = 0 ] ; then 601.2Scgd echo "usage: $0 [-c] [-m] [-n] dir ..." 611.1Scgd exit 2 621.1Scgdfi 631.1Scgd 641.1ScgdTMP=/tmp/bump$$ 651.1Scgderror=0 661.1Scgd 671.1Scgdtrap 'rm -f $TMP ; exit 1' 1 2 3 13 15 681.1Scgd 691.1Scgdfor dir in $@ ; do 701.1Scgd versf=$dir/shlib_version 711.1Scgd 721.1Scgd if [ "X$create" != "X" ] ; then 731.1Scgd if [ ! -d $dir ] ; then 741.1Scgd echo $0: $dir is not a directory 1>&2 751.1Scgd error=1 761.1Scgd continue 771.1Scgd fi 781.1Scgd if [ -e $versf ] ; then 791.1Scgd echo $0: $versf exists\; not replacing 1>&2 801.1Scgd error=1 811.1Scgd continue 821.1Scgd fi 831.1Scgd else 841.1Scgd if [ ! -e $versf ] ; then 851.1Scgd echo $0: $versf does not exist 1>&2 861.1Scgd error=1 871.1Scgd continue 881.1Scgd fi 891.1Scgd if [ ! -f $versf ] ; then 901.1Scgd echo $0: $versf is not a regular file 1>&2 911.1Scgd error=1 921.1Scgd continue 931.1Scgd fi 941.1Scgd if [ ! -r $versf ] ; then 951.1Scgd echo $0: $versf is not readable 1>&2 961.1Scgd error=1 971.1Scgd continue 981.1Scgd fi 991.1Scgd if [ ! -w $versf ] ; then 1001.1Scgd echo $0: $versf is not a writable 1>&2 1011.1Scgd error=1 1021.1Scgd continue 1031.1Scgd fi 1041.1Scgd 1051.1Scgd . $versf 1061.1Scgd fi 1071.1Scgd 1081.1Scgd if [ "X$create" != "X" ] ; then 1091.1Scgd nmajor=0 1101.1Scgd nminor=0 1111.1Scgd elif [ "X$bumpmajor" != "X" ] ; then 1121.1Scgd nmajor=`expr $major + 1` 1131.1Scgd nminor=0 1141.1Scgd else 1151.1Scgd nmajor=$major 1161.1Scgd nminor=`expr $minor + 1` 1171.1Scgd fi 1181.1Scgd 1191.1Scgd if [ "X$donothing" = "X" ] ; then 1201.1Scgd echo major=$nmajor > $TMP 1211.1Scgd echo minor=$nminor >> $TMP 1221.1Scgd mv $TMP $versf 1231.1Scgd else 1241.1Scgd echo "$0: $versf -> $nmajor.$nminor" 1251.1Scgd fi 1261.1Scgddone 1271.1Scgd 1281.1Scgdexit $error 129