blob: 9754103d17846a750d08a2df94a44a0f790df38f (
plain)
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
|
_showmsg() {
cat << EOF
########################################################################
########################################################################
## ##
## Cellframe Dashboard - The super application with Cellframe node ##
## ______________________________________________________________ ##
## ##
## To start: ##
## ##
## 1. systemctl enable --now cellframe-node.service ##
## ##
## 2. systemctl enable --now cellframe-dashboard.service ##
## ##
## 3. Launch Cellframe Dashboard from your applications ##
## ##
## OPTIONAL: ##
## systemctl enable --now cellframe-node-logrotate.timer ##
## ##
## For more aggressive log rotating ##
## ##
########################################################################
########################################################################
EOF
}
post_install() {
NODE_PATH="/opt/cellframe-node"
DASHBOARD_PATH="/opt/cellframe-dashboard"
NODE_CFG="$NODE_PATH/etc/cellframe-node.cfg"
echo "+++ Generating node configuration file..."
cp $NODE_PATH/share/configs/cellframe-node.cfg.tpl $NODE_PATH/etc/cellframe-node.cfg
chmod 0666 $NODE_CFG
sed -i 's|{DEBUG_MODE}|false|' $NODE_CFG
sed -i 's|{PREFIX}|/opt/cellframe-node|g' $NODE_CFG
sed -i 's|{AUTO_ONLINE}|true|' $NODE_CFG
sed -i 's|{SERVER_ENABLED}|true|' $NODE_CFG
sed -i 's|{SERVER_ADDR}|0.0.0.0|' $NODE_CFG
sed -i 's|{SERVER_PORT}|8079|' $NODE_CFG
sed -i 's|{NOTIFY_SRV_ADDR}|127.0.0.1|' $NODE_PATH/etc/cellframe-node.cfg
sed -i 's|{NOTIFY_SRV_PORT}|8080|' $NODE_PATH/etc/cellframe-node.cfg
sed -i "s|{DB_DRIVER}|mdbx|" $NODE_PATH/etc/cellframe-node.cfg
echo "+++ Generating network configuration files..."
for _networks in mileena KelVPN Backbone
do
cp $NODE_PATH/share/configs/network/$_networks.cfg.tpl $NODE_PATH/etc/network/$_networks.cfg
sed -i 's|{NODE_TYPE}|full|' $NODE_PATH/etc/network/$_networks.cfg
done
systemctl daemon-reload
echo "+++ Creating symbolic links for executables..."
for _executables in cellframe-node-cli cellframe-node-tool cellframe-node
do
chmod a+x $NODE_PATH/bin/$_executables
ln -sf $NODE_PATH/bin/$_executables /usr/local/bin/$_executables
done
chmod +x $DASHBOARD_PATH/bin/*
ln -sf $DASHBOARD_PATH/bin/Cellframe-Dashboard /usr/local/bin/Cellframe-Dashboard
mkdir -p $NODE_PATH/var/{run,lib/wallet,lib/global_db,lib/plugins,lib/ca,log}
chmod 0777 $NODE_PATH/var/lib/ca/
mkdir -p $DASHBOARD_PATH/dapps/download && chmod -R 0777 $DASHBOARD_PATH/dapps
update-desktop-database
_showmsg
}
pre_upgrade() {
for _active in cellframe-dashboard.service cellframe-node.service cellframe-node-logrotate.timer
do
systemctl is-active --quiet $_active.service && systemctl stop $_active.service && echo "+++ Stopped $_active service..."
done
}
post_upgrade() {
systemctl daemon-reload
for _active in cellframe-dashboard.service cellframe-node.service cellframe-node-logrotate.timer
do
systemctl is-enabled --quiet $_active && systemctl start $_active && echo "+++ Started $_active..."
done
_showmsg
}
pre_remove() {
for _active in cellframe-dashboard.service cellframe-node.service cellframe-node-logrotate.timer
do
systemctl is-active --quiet $_active && systemctl stop --quiet $_active && echo "+++ Stopped $_active..."
systemctl is-enabled --quiet $_active && systemctl disable --quiet $_active && echo "+++ Disabled $_active..."
done
}
post_remove() {
systemctl daemon-reload
echo "+++ Removing symbolic links..."
for _executables in cellframe-node-cli cellframe-node-tool cellframe-node Cellframe-Dashboard
do
unlink /usr/local/bin/$_executables
done
}
|