-
Notifications
You must be signed in to change notification settings - Fork 27
/
upgrade_release_version.sh
63 lines (51 loc) · 1.33 KB
/
upgrade_release_version.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
function usage() {
echo " -h help"
echo " -o <oldversion>"
echo " -n <newversion>"
}
function replace() {
declare -a fileList=(
"adyenv6b2ccheckoutaddon/resources/adyenv6b2ccheckoutaddon.build.number"
"adyenv6backoffice/resources/adyenv6backoffice.build.number"
"adyenv6core/resources/adyenv6core.build.number"
"adyenv6fulfilmentprocess/resources/adyenv6fulfilmentprocess.build.number"
"adyenv6ordermanagement/resources/adyenv6ordermanagement.build.number"
"adyenv6notification/resources/adyenv6notification.build.number"
"adyenv6core/src/com/adyen/v6/constants/Adyenv6coreConstants.java"
)
for FILENAME in "${fileList[@]}"
do
XMLTMPFILE=$FILENAME.bak
echo "Updating file - $FILENAME"
cat $FILENAME > $XMLTMPFILE
sed -i.bak s/${OLDVERSION}/${NEWVERSION}/g $FILENAME
rm -f $XMLTMPFILE
done
}
while getopts "ho:n:" o; do
case $o in
h)
usage
;;
o)
OLDVERSION=${OPTARG};;
n)
NEWVERSION=${OPTARG};;
esac
done
echo "Old release version is" $OLDVERSION
echo "New release version is" $NEWVERSION
if [ -z $OLDVERSION ]; then
echo "Please specify the 'oldversion' argument";
usage;
exit 1;
fi
if [ -z $NEWVERSION ]; then
echo "Please specify the 'newversion' argument";
usage;
exit 1;
fi
replace
echo "Finished ${FILENAME}"
exit $RT