summaryrefslogtreecommitdiff
path: root/setver
blob: b0b5cfe92ecc9a533415a4128c546afbf52fb320 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
#!/bin/sh
#    setver - set version number for ipmiutil package
# 
# Usage:  setver [version] [doinc?=y/n/r]
#    if [version] is specified, assume increment, unless
#    [doinc?] is 'n'.
#    if [doinc?] is 'r', reverse increment (decrement).
#
ver=3.1.1
rel=1
tmped=/tmp/edver.tmp
tmpspec=/tmp/edspec.tmp
cmdf=/tmp/cmd.tmp
skipinc=0
reverseinc=0

if [ $# -gt 0 ]
then
  ver=$1
  if [ "$2" = "n" ]
  then
     # no, skip incrementing the versions
     skipinc=1
  else
     if [ "$2" = "r" ]
     then
	# r = reverse increment
        reverseinc=1
     else
        # yes, increment the versions
        skipinc=0
     fi
  fi
fi
v12=`echo $ver |cut -f1,2 -d'.'`
v3=`echo $ver |cut -f3 -d'.'`
vras=`echo $ver |sed -e 's/\.//g'`

distro=`echo $MACHTYPE |cut -d'-' -f2`
if [ "$distro" = "suse" ]
then
   pkgdir=/usr/src/packages
else
   if [ "$distro" = "hardhat" ]
   then
      pkgdir=/usr/src/montavista
   else
      # usu redhat if here
      pkgdir=/usr/src/$distro
   fi
fi

cat - <<%%% >$tmped
1
/^AM_INIT_AUTOMAKE(
c
AM_INIT_AUTOMAKE(ipmiutil,$ver)
.
w
q
%%%
if [ -f configure.ac ]; then
  sed -i "/AC_INIT(ipmiutil,/cAC_INIT(ipmiutil,$ver)" configure.ac
  # sed -i "/INIT_AUTOMAKE(ipmiutil/cAM_INIT_AUTOMAKE(ipmiutil,$ver)" configure.ac
else
  ed configure.in <$tmped
fi

cat - <<%%% >$tmped
1
/^PKGDIR=
c
PKGDIR=${pkgdir}
.
w
q
%%%
ed Makefile.am <$tmped

cat - <<%%% >$tmped
1
/^VERSION = 
c
VERSION = $ver
.
w
q
%%%
ed configure <$tmped

cat - <<%%% >$tmpspec
1
/^Version:
c
Version: ${ver}
.
/^Release:
c
Release: ${rel}%{?dist}
.
w
q
%%%
ed doc/ipmiutil.spec <$tmpspec

# mk_* - scripts used for my local mods
cat - <<%%% >$tmped
1
/^iver
c
iver=${ver}
.
w
q
%%%
if [ -f ../buildipmiutil.sh ]
then
  ed ../buildipmiutil.sh   <$tmped
fi

cat - <<%%% >$tmped
1
/^set pkgver
c
set pkgver=${ver}
.
w
q
%%%
if [ -f ../win32/src/mkzip.bat ]; then
  ed ../win32/src/mkzip.bat   <$tmped
fi
if [ -f ../win32/src/mkzip32.bat ]; then
  ed ../win32/src/mkzip32.bat   <$tmped
fi
if [ -f ../win32/src/mkzip64.bat ]; then
  ed ../win32/src/mkzip64.bat   <$tmped
fi

if [ -f ../win32/mkraszip.bat ]
then
  cat - <<%%% >$tmped
1
/^set pkgver
c
set pkgver=${vras}
.
w
q
%%%
  ed ../win32/mkraszip.bat   <$tmped
fi

if [ -f doc/UserGuide ]
then
  cat - <<%%% >$tmped
1
/VERSION
c
                     VERSION ${ver}
.
w
q
%%%
  ed doc/UserGuide   <$tmped
fi

if [ -f ../../ipmimisc/buildmisc.sh ]
then
  cat - <<%%% >$tmped
1
/^utilver
c
utilver=${ver}
.
w
q
%%%
  ed ../../ipmimisc/buildmisc.sh   <$tmped
fi

if [ -f debpkg/changelog ]; then
  rdate=`date -R`
  cat - <<%%% >$tmped
1
i
ipmiutil (${ver}-${rel}) unstable; urgency=low

  * New upstream version.

 -- Andy Cress <arcress@users.sourceforge.net>  ${rdate}

.
w
q
%%%
  ed debpkg/changelog   <$tmped
fi

cmdc="ifruset.c iseltime.c ievents.c idiscover.c ipmiutil.c"
otherc="ialarms.c icmd.c iconfig.c ievents.c ifru.c igetevent.c ihealth.c 
      ilan.c ireset.c isel.c isensor.c iserial.c isol.c iwdt.c itsol.c  
      ipicmg.c ifirewall.c idcmi.c iuser.c iekanalyzer.c ifwum.c ihpm.c
      oem_intel.c oem_kontron.c oem_dell.c oem_hp.c oem_sun.c oem_asus.c 
      oem_fujitsu.c oem_lenovo.c oem_newisys.c oem_quanta.c oem_supermicro.c"

if [ $skipinc -ne 1 ]
then
  # set each of the utility progver values to the specified version.
  relnote=/tmp/ipmiutil.rel
  #utilc="ipmiutil.c ialarms.c icmd.c iconfig.c igetevent.c ihealth.c 
     #ifru.c ilan.c ireset.c isensor.c isel.c iserial.c isol.c iwdt.c
     #ievents.c idiscover.c ipmi_port.c"
  utilc="$cmdc"
  echo $utilc >$cmdf

  cd util
  # echo "  ipmiutil-$ver contains:" >$relnote
  num=0
  for f in $utilc
  do
      fver=`grep "progver   = " $f |cut -f2 -d'=' |cut -f2 -d'"'`
      fver1=`echo $fver |cut -f1 -d'.'`
      fver2=`echo $fver |cut -f2 -d'.'`
      if [ $reverseinc -eq 1 ]
      then      
          fvernew=${fver1}.`expr $fver2 - 1`
      else
          # fvernew=${fver1}.`expr $fver2 + 1`
          # use the specified version from above
          fvernew=${v12}${v3}
      fi
      tmpf=/tmp/$f.new
      tag=`grep "progname  = " $f |cut -f2 -d'=' |cut -f2 -d'"'`
      alias=`grep "int argc" $f |head -n1 |cut -f1 -d'(' |awk '{print $2}' |sed -e 's/i_/ipmiutil /'`
      if [ "$f" = "ipmi_port.c" ]; then
          do_incr=0
          tag=ipmi_port
          alias=ipmi_port
      elif [ "$f" = "iseltime.c" ]; then
          alias=iseltime
          do_incr=0
      elif [ "$f" = "ifruset.c" ]; then
          alias=ifruset
          do_incr=0
      elif [ "$f" = "idiscover.c" ]; then
          do_incr=0
      elif [ "$f" = "iekanalyzer.c" ]; then
          do_incr=0
      elif [ "$f" = "ifwum.c" ]; then
          do_incr=0
      elif [ "$f" = "ihpm.c" ]; then
          do_incr=0
      else 
          do_incr=1
      fi
      num=`expr $num + 1`
      f1=`echo $f |cut -f1 -d'.'`
      if [ $do_incr -eq 0 ]; then
        # don't update the version 
        fvernew=$fver
        echo "$tag   	progver: $fvernew"
        # echo "    $tag	($alias)  	 ver $fvernew" >>$relnote
      else
        # update the version automatically 
        sed -e "s/progver   = .${fver}/progver   = \"${fvernew}/" $f >$tmpf
        cp -f $tmpf $f
        echo "$tag   	progver: $fvernew"
        # echo "    $tag	($alias)  	 ver $fvernew" >>$relnote
      fi
  done
  cd ..
  # cat $relnote >>ChangeLog
fi

echo ""
echo "Version changed to $ver, now run beforeconf.sh, then ./configure"