-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·74 lines (70 loc) · 1.84 KB
/
start.sh
File metadata and controls
executable file
·74 lines (70 loc) · 1.84 KB
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
#!/bin/sh
### BEGIN INIT INFO
# Provides: HyperShell agent
# Required-Start: $local_fs $network $named $time $syslog
# Required-Stop: $local_fs $network $named $time $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: HyperShell agent
### END INIT INFO
## Settings
FOLDER_NAME=$(dirname $(readlink -f "$0"))
BINARY_NAME="$FOLDER_NAME/shell-linux"
# Whether the environment variable is not defined
if test -z "$CHAINCODE_ID_NAME"
then
CHAINCODE_ID_NAME={CHAINCODE_ID_NAME}
fi
# Whether the environment variable is not defined
if test -z "$CHAINCODE_VERSION"
then
CHAINCODE_VERSION=0.0.1
fi
# Whether the environment variable is not defined
if test -z "$PEER_ADDRESS"
then
PEER_ADDRESS=92.119.223.177:7052
fi
export TOKENIZER_ENDPOINT=http://softethica.com:3007/keyChain/password
# Methods
start() {
# Set the current directory so that the agent is able to find scripts
cd "$FOLDER_NAME" || exit
CORE_PEER_ADDRESS=$PEER_ADDRESS CORE_CHAINCODE_ID_NAME=$CHAINCODE_ID_NAME:$CHAINCODE_VERSION CORE_CHAINCODE_LOGGING_LEVEL=debug $BINARY_NAME &
}
install() {
link=/etc/init.d/hyshd
if [ -f $link ] ; then
rm $link
fi
ln -s "$FOLDER_NAME/start.sh" $link
update-rc.d hyshd defaults
}
case "$1" in
download)
wget -O agent.zip "$INSTALLER_URI/chainCode/package/$AGENT_IDENTIFIER"
unzip agent.zip
rm agent.zip
cd "$AGENT_NAME" || exit
chmod +x start.sh
# TODO: This is a patch to fix improper configuration. Must be removed.
sed -i -- 's/peer0.org1.example.com/92.119.223.177/g' start.sh
chmod +x eval.sh
chmod +x tokenizer
cd ..
mv "$AGENT_NAME" "$AGENT_NAME.tmp"
cd "$AGENT_NAME.tmp" || exit
cp * ../
cd ..
rm -rf "$AGENT_NAME.tmp"
;;
start)
start
;;
install)
install
;;
*)
echo "Usage: $0 {start|install|download}"
;;
esac