forked from rickyrockrat/parcellite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsvnversion.sh
executable file
·41 lines (40 loc) · 878 Bytes
/
svnversion.sh
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
#!/bin/sh
echo "$0">svnversion.log
if [ -n "$1" ]; then
echo "Immediate Mode">>svnversion.log
IM=1
else
IM=0
fi
which svnversion > _svnversion_test
if [ $? -ne 0 ] ;then
echo "svn"
else
CWD=$(pwd)
#path supplied?
D=$(dirname $0)
if [ "." = "$D" ]; then
PPATH="$CWD" #no
else
PPATH="$D"
fi
cd "$PPATH"
# are we lndired?
LINK=$(readlink configure.ac)
if [ -n "$LINK" ]; then #link
FULLPATH=$(dirname "$LINK")
else
FULLPATH="$CWD"
fi
cd "$FULLPATH"
echo "Using $FULLPATH">>"$CWD/svnversion.log"
SVER=$(svn info .|grep -i "revision"|sed 's!.*: !!'|tr -d ' ')
echo -n "svn$SVER"
cd $CWD
if [ "$IM" = "1" ]; then
sed -i "s#\(.*VERSION \).*#\1\"svn$SVER\"#" config.h
echo "Make sure to do svn up in source svn to update local svn info, then run again."
rm src/main.o
echo "Removed src/main.o. Recompile."
fi
fi