TMP rm bright-ben
[librewrt/.git] / packages / xwrt / webif / embed_rev.sh
1 #!/bin/sh
2 #
3 # this script embeds the global revision number in document(s) given 
4 # on command line
5 # document should have __SVN_REVISION__ where it wants the revision 
6 # number to be placed. Wildcards okay.
7 #
8 if [ $# -lt 1 ]; then
9         echo " Invalid usage. Must supply one or more files."
10         exit 1
11 fi
12 revision_number=$(svn info | grep Revision | cut -c11-)
13 echo " Revision number is $revision_number"
14 until [ -z "$1" ]  
15 do
16         for curfile in $(grep -H "__SVN_REVISION__" -r "$1" | cut -d':' -f1 | sed '/\.svn\//d'); do
17                 echo " Processing $curfile ..."
18                 sed -i -e "s/__SVN_REVISION__/$revision_number/" "$curfile"
19         done
20         shift
21 done
22