forked from bahamapascal/ICCR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
patch-iccr-1.0.6.bash
108 lines (95 loc) · 2.48 KB
/
patch-iccr-1.0.6.bash
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/bash
ver=1.0.0-rc3
pkg=iccr-${ver}.tgz
dir=/opt
iccrDir=$dir/iccr
iccrPropDir=$iccrDir/conf
iccrPropFile=$iccrPropDir/iccr.properties
iccrBinDir=$dir/iccr/bin
iccrLibDir=$dir/iccr/lib
what=ICCR
mac=0
darwin=`uname | grep -i darwin`
if [ $darwin = "Darwin" ]; then
mac=1
fi
archDir=`pwd`
tmpDir=/tmp/iccr-$ver
if [ ! -f $pkg ]; then
echo "Failed to find the required $what archive file ($pkg) in the local directory!"
echo "I can't continue"
exit
fi
if [ ! -d $iccrDir ]; then
echo "Existing $what install ($iccrDir) not found!"
echo "I can not continue"
exit
fi
echo "This script will patch the $what software that is in $iccrDir"
echo
echo "Make sure the $what process is halted by running $iccrDir/bin/iccr-ctl stop"
echo "Press enter..."
read junk
echo
echo "Extracting $pkg into temporary directory..."
echo
mkdir $tmpDir
cd $tmpDir
tar -xzf $archDir/$pkg
echo "Copying in place updated $what version $ver binary and script files..."
echo
echo "cp -f $tmpDir/iccr/bin/* $iccrBinDir"
cp -fr $tmpDir/iccr/bin/* $iccrBinDir
echo
echo "cp -fr $tmpDir/iccr/lib/* $iccrLibDir"
cp -fr $tmpDir/iccr/lib/* $iccrLibDir
cd -
rm -rf $tmpDir
###
# Prompt for permission to install new defaults:
###
prop=iotaDownloadLink
sVal="http:\/\/85.93.93.110\/iri-1.1.2.3.jar"
val="http://85.93.93.110/iri-1.1.2.3.jar"
curVal=`grep $prop $iccrPropFile | sed -e "s/${prop}=//g"`
if [ "${curVal}" != "${val}" ]; then
echo
echo There is a new default value for the $prop $what configuration property: $val
echo Do you want that value to be inserted? [Y/n]
read yN
if [ -z "${yN}" ]; then
yN=Y
fi
if [ "${yN}" = "Y" ]; then
if [ "${mac}" = "1" ]; then
`sed -i '' "s/^${prop}=.*$/${prop}=${sVal}/g" $iccrPropFile`
else
`sed -i "s/^${prop}=.*$/${prop}=${sVal}/g" $iccrPropFile`
fi
else
echo Ok, leaving existing value: $curVal
fi
fi
prop=iotaStartCmd
val="java -jar IRI.jar -p"
curVal=`grep $prop $iccrPropFile | sed -e "s/${prop}=//g"`
if [ "${curVal}" != "${val}" ]; then
echo
echo There is a new default value for the $prop $what configuration property: $val
echo Do you want that value to be inserted? [Y/n]
read yN
if [ -z "${yN}" ]; then
yN=Y
fi
if [ "${yN}" = "Y" ]; then
if [ "${mac}" = "1" ]; then
`sed -i '' "s/^${prop}=.*$/${prop}=${val}/g" $iccrPropFile`
else
`sed -i "s/^${prop}=.*$/${prop}=${val}/g" $iccrPropFile`
fi
else
echo Ok, leaving existing value: $curVal
fi
fi
echo
echo "Done"