-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathupdateSVN
executable file
·56 lines (49 loc) · 1.46 KB
/
updateSVN
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
#!/bin/sh
if [ -z "$1" -o -z "$2" ]; then
echo ""
echo " Usage: updateSVN <src-root> <target-resources-dir>"
echo ""
exit 1
fi
OWD=`pwd`
cd "$1"
if [ -e .svn ]; then
SVN=svn
for paths in /usr/local/bin /opt/R/arm64/bin; do
if [ -e "$paths/svn" ]; then
SVN="$paths/svn"
fi
done
SVNREV=`$SVN info | sed -n 's/Revision:[ \t]*//p'`
if [ -z "$SVNREV" -a -f .svn/entries ]; then
SVNREV=`sed -n 's/.*revision="\(.*\)".*/\1/p' .svn/entries|head -n 1`
if [ -z "$SVNREV" ]; then
# SVN 1.4 changed the format - this is a pure guess!! (line 4 = revision)
SVNREV=`sed -n -e '4 p' .svn/entries`
fi
fi
elif [ -e REVISION ]; then
SVNREV=`cat REVISION`
elif [ -e .git ]; then
SVNREV=`git rev-parse --short HEAD`
fi
echo "Revision: $SVNREV"
if [ -z "$SVNREV" ]; then
echo "Cannot determine SVN revision."
exit 2
fi
if [ ! -e "$1/Info.plist" ]; then
echo "Cannot find Info.plist"
exit 3;
fi
# we no longer use InfoPlist.strings
#sed "s/%SVN%/$SVNREV/g" "$1/English.lproj/InfoPlist.strings" > "$2/English.lproj/InfoPlist.strings"
# Info.plist is actually one level below resources
#sed "s/%SVN%/$SVNREV/g" "$1/Info.plist" > "$2/../Info.plist"
# we have to use the target Info.plist because it has been pre-processed by Xcode
sed "s/%SVN%/$SVNREV/g" "$2/../Info.plist" > "$2/../Info.plist.final"
if [ -e "$2/../Info.plist.final" ]; then
rm -f "$2/../Info.plist"
mv "$2/../Info.plist.final" "$2/../Info.plist";
fi
exit 0