forked from ApolloFoundation/Apollo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update1.sh
executable file
·67 lines (53 loc) · 1.86 KB
/
update1.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
64
65
66
67
#!/bin/bash
# first parameter is a current directory, where wallet is executing now (directory, which we should update)
# second parameter is a update directory which contains unpacked jar for update
# third parameter is a boolean flag, which indicates desktop mode
if [ -d $1 ] && [ -d $2 ] && [ -n $3 ]
then
echo Starting Platform Dependent Updater
echo Stopping wallet....
NEXT_WAIT_TIME=0
until [ $(ps aux | grep Apollo.jar | grep -v grep | wc -l) -eq 0 ] || [ $NEXT_WAIT_TIME -eq 10 ]; do
NEXT_WAIT_TIME=`expr $NEXT_WAIT_TIME '+' 1`
sleep $NEXT_WAIT_TIME
echo "Waiting more time to stop wallet..."
done
echo Copy update files
cp -vRa $2/* $1
unamestr=`uname`
if [[ "$unamestr" == 'Darwin' ]]; then
mv "$1/ApolloWallet+Secure Transport.app" $1/../
mv "$1/ApolloWallet+Tor.app" $1/../
chmod 755 "$1/../ApolloWallet+Secure Transport.app/Contents/MacOS/apl"
chmod 755 "$1/../ApolloWallet+Secure Transport.app/secureTransport/securenodexchg"
chmod 755 "$1/../ApolloWallet+Secure Transport.app/secureTransport/*.sh"
chmod 755 "$1/../ApolloWallet+Tor.app/Contents/MacOS/apl"
chmod 755 "$1/../ApolloWallet+Tor.app/tor/bin/tor"
fi
if [[ "$unamestr" == 'Linux' ]]; then
chmod 755 $1/tor/tor
chmod 755 $1/secureTransport/securenodexchg
chmod 755 $1/secureTransport/runClient.sh
fi
if [[ "$unamestr" == 'Darwin' ]]; then
chmod 755 $1/jre/bin/* $1/jre/lib/lib*
chmod 755 $1/jre/lib/jspawnhelper $1/jre/lib/jli/* $1/jre/lib/lib*
elif [[ "$unamestr" == 'Linux' ]]; then
chmod 755 $1/jre/bin/*
fi
cd $1
chmod 755 *.sh
cd $1
chmod 755 *.sh
./replace_dbdir.sh
if [ $3 == true ]
then
echo Start desktop application
./start-desktop.sh
else
echo Start command line application
./start.sh
fi
else
echo Invalid input parameters $1,$2,$3
fi