forked from Adyen/adyen-java-api-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upgrade_release_version.sh
54 lines (43 loc) · 964 Bytes
/
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
#!/bin/bash
function usage() {
echo " -h help"
echo " -o <oldversion>"
echo " -n <newversion>"
}
function replace() {
declare -a fileList=("README.md" "pom.xml" "src/main/java/com/adyen/Client.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