root/tools/bump_rev.sh

Revision 2768, 0.9 kB (checked in by cpebenito, 4 months ago)

tools: add version bumping tools.

  • Property svn:executable set to *
Line 
1 #!/bin/bash
2
3 # bump revision number on modified policy modules in svn
4
5 bump_rev() {
6         VERSION=`grep '^policy_module' $1 | m4 -D policy_module='$2'`
7         MAJOR=`echo $VERSION | cut -d. -f1`
8         MINOR=`echo $VERSION | cut -d. -f2`
9         REV=`echo $VERSION | cut -d. -f3`
10         [ -z "$REV" ] && REV="0"
11
12         NEWREV=$(( $REV + 1 ))
13         sed -i -e "/^policy_module/s/$MAJOR.$MINOR.$REV/$MAJOR.$MINOR.$NEWREV/" $1
14         echo `basename $1`:$MAJOR.$MINOR.$NEWREV
15
16         # add in a space after the comma, if its missing
17         sed -i -r -e "/^policy_module[^,]+,[^ ]/s/,/, /" $1
18 }
19
20 if [ $# -gt 0 ]; then
21         while [ $# -gt 0 ]; do
22                 bump_rev $1
23                 shift
24         done
25 else
26         if [ ! -d policy/modules ]; then
27                 echo "Must run this from the root of the policy source."
28                 exit 1
29         fi
30
31         FILES=$(svn st | sed -n -r -e '/^M.*\.(te|if|fc)/s/\.(in|m4)$//' -e '/^M.*\.(te|if|fc)$/s/\.(te|if|fc)$/.te/p' | sed -e 's/corenetwork\.te/corenetwork.te.in/' | awk '{ print $2 }' | sort | uniq)
32
33         for i in ${FILES}; do
34                 bump_rev $i
35         done
36 fi
Note: See TracBrowser for help on using the browser.