xref: /netbsd-src/external/bsd/nsd/dist/contrib/bind2nsd/set_version (revision d83a80ee7fb31190352cf1f781441e06ca6a86db)
1*d83a80eeSchristos#!/bin/sh
2*d83a80eeSchristos# Copyright (c) 2007, Secure64 Software Corporation
3*d83a80eeSchristos#
4*d83a80eeSchristos# Permission is hereby granted, free of charge, to any person obtaining a copy
5*d83a80eeSchristos# of this software and associated documentation files (the "Software"), to deal
6*d83a80eeSchristos# in the Software without restriction, including without limitation the rights
7*d83a80eeSchristos# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8*d83a80eeSchristos# copies of the Software, and to permit persons to whom the Software is
9*d83a80eeSchristos# furnished to do so, subject to the following conditions:
10*d83a80eeSchristos#
11*d83a80eeSchristos# The above copyright notice and this permission notice shall be included in
12*d83a80eeSchristos# all copies or substantial portions of the Software.
13*d83a80eeSchristos#
14*d83a80eeSchristos# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*d83a80eeSchristos# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*d83a80eeSchristos# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17*d83a80eeSchristos# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18*d83a80eeSchristos# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19*d83a80eeSchristos# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20*d83a80eeSchristos# THE SOFTWARE.
21*d83a80eeSchristos#
22*d83a80eeSchristos#
23*d83a80eeSchristos#
24*d83a80eeSchristos#   set the version number in the right files
25*d83a80eeSchristos#
26*d83a80eeSchristos
27*d83a80eeSchristosif [ $# -ne "1" ]
28*d83a80eeSchristosthen
29*d83a80eeSchristos   echo "usage: set_version <new>"
30*d83a80eeSchristos   exit 1
31*d83a80eeSchristosfi
32*d83a80eeSchristosNEWV=$1
33*d83a80eeSchristos
34*d83a80eeSchristos#-- report on the current version numbers
35*d83a80eeSchristosSETUPV=$(grep -i version setup.py | sed 's/version = //' | sed "s/'//g" | \
36*d83a80eeSchristos         sed 's/,//' | sed 's/[ ]*//g')
37*d83a80eeSchristosecho "setup.py is currently => ${SETUPV}"
38*d83a80eeSchristos
39*d83a80eeSchristosCONFIGV=$(grep -i version bind2nsd/Config.py | sed "s/'version'//" | \
40*d83a80eeSchristos          sed "s/: '//" | sed "s/',//" | sed 's/[ \t]*//g')
41*d83a80eeSchristosecho "bind2nsd/Config.py is currently => ${CONFIGV}"
42*d83a80eeSchristos
43*d83a80eeSchristos#-- replace them
44*d83a80eeSchristossed --in-place=.bak \
45*d83a80eeSchristos    "s/      version = '${SETUPV}',/      version = '${NEWV}',/" setup.py
46*d83a80eeSchristos
47*d83a80eeSchristossed --in-place=.bak \
48*d83a80eeSchristos    "s/[ \t]*'version'[ \t]*: '${CONFIGV}',/           'version'             : '${NEWV}',/" bind2nsd/Config.py
49*d83a80eeSchristos
50*d83a80eeSchristos#-- report on the new version numbers
51*d83a80eeSchristosSETUPV=$(grep -i version setup.py | sed 's/version = //' | sed "s/'//g" | \
52*d83a80eeSchristos         sed 's/,//' | sed 's/[ ]*//g')
53*d83a80eeSchristosecho "setup.py is now => ${SETUPV}"
54*d83a80eeSchristos
55*d83a80eeSchristosCONFIGV=$(grep -i version bind2nsd/Config.py | sed "s/'version'//" | \
56*d83a80eeSchristos          sed "s/: '//" | sed "s/',//" | sed 's/[ \t]*//g')
57*d83a80eeSchristosecho "bind2nsd/Config.py is now => ${CONFIGV}"
58