-
Notifications
You must be signed in to change notification settings - Fork 11
/
selfservice-update.sh
210 lines (193 loc) · 7.14 KB
/
selfservice-update.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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#!/bin/sh
if [ -f "/var/www/html/tgcount.php" ];
then
sudo systemctl stop apache2
#echo "found file"
else
echo "file not found"
fi
if [ -f "/var/www/html/tgcount.php" ];
then
sudo systemctl disable apache2
#echo "found file"
else
echo "file not found"
fi
if [ -f "/var/www/html/tgcount.php" ];
then
sudo rm /var/www/html/* -r
#echo "found file"
else
echo "file not found"
fi
if [ -d "/var/www/fdmr" ];
then
sudo rm /var/www/fdmr/ -r
#echo "found file"
else
echo "file not found"
fi
sudo systemctl stop proxy.service
sudo systemctl stop fdmr_mon.service
sudo systemctl stop http.server-fmr.service
sudo systemctl disable http.server-fmr.service
sudo rm -r /opt/FDMR-Monitor/
sudo systemctl stop http.server-fdmr.service
#
cd /opt
sudo git clone https://github.com/hp3icc/FDMR-Monitor.git
cd FDMR-Monitor
sudo git checkout Self_Service
sudo chmod +x install.sh
#sudo ./install.sh
#sudo cp fdmr-mon_SAMPLE.cfg fdmr-mon.cfg
sudo sed -i 's/RELOAD_TIME = 15/RELOAD_TIME = 1/' /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg
#sudo cp utils/logrotate/fdmr_mon /etc/logrotate.d/
rm /etc/logrotate.d/fdmr_mon
rm /lib/systemd/system/fdmr_mon.service
#sudo cp utils/systemd/fdmr_mon.service /lib/systemd/system/
sudo sed -i 's/FREQUENCY = 10/FREQUENCY = 120/' /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg
sudo chmod 644 /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg
sed '33 a <!--' -i /opt/FDMR-Monitor/html/sysinfo.php
sed '35 a -->' -i /opt/FDMR-Monitor/html/sysinfo.php
####
sudo sed -i 's/localhost_2-day.png/localhost_1-day.png/' /opt/FDMR-Monitor/html/sysinfo.php
sudo sed -i "s/HBMonv2/FDMR-Monitor/g" /opt/FDMR-Monitor/sysinfo/*.sh
sudo chmod +x /opt/FDMR-Monitor/sysinfo/cpu.sh
sudo chmod +x /opt/FDMR-Monitor/sysinfo/graph.sh
sudo chmod +x /opt/FDMR-Monitor/sysinfo/rrd-db.sh
#sudo chmod +x /opt/FDMR-Monitor/updateTGIDS.sh
#
sudo cat > /opt/FDMR-Monitor/html/buttons.php <<- "EOF"
<!-- HBMonitor buttons HTML code -->
<a class="button" href="index.php">Home</a>
<div class="dropdown">
<button class="dropbtn">Links</button>
<div class="dropdown-content">
<a class="button" href="linkedsys.php">Linked Systems</a>
<a class="button" href="statictg.php">Static TG</a>
<a class="button" href="opb.php">OpenBridge</a>
</div>
</div>
<div class="dropdown">
<button class="dropbtn">Self Service</button>
<div class="dropdown-content">
<?php if(!PRIVATE_NETWORK){echo '<a class="button" href="selfservice.php">SelfService</a>';}?>
<a class="button" href="login.php">Login</a>
<?php
if(isset($_SESSION["auth"], $_SESSION["callsign"], $_SESSION["h_psswd"]) and $_SESSION["auth"]){
echo '<a class="button" href="devices.php">Devices</a>';
}
?>
</div>
</div>
<div class="dropdown">
<button class="dropbtn">Local Server</button>
<div class="dropdown-content">
<a class="button" href="moni.php"> Monitor </a>
<a class="button" href="sysinfo.php"> System Info </a>
<a class="button" href="log.php"> Lastheard </a>
<a class="button" href="tgcount.php"> TG Count </a>
</div>
</div>
<div class="dropdown">
<button class="dropbtn">FreeDMR</button>
<div class="dropdown-content">
<a class="button" href="http://www.freedmr.uk/index.php/why-use-freedmr/"target="_blank"> Info FreeDMR </a>
<a class="button" href="http://www.freedmr.uk/index.php/freedmr-servers/"target="_blank"> Info Server </a>
<a class="button" href="http://www.freedmr.uk/server_test.php"target="_blank"> Status Server </a>
<a class="button" href="http://www.freedmr.uk/index.php/world-wide-talk-groups/"target="_blank"> World Wide Talk Groups </a>
<a class="button" href="http://www.freedmr.uk/freedmr/option-calculator-b.php"target="_blank"> Static TG Calculator </a>
</div>
</div>
<!--
<a class="button" href="bridges.php">Bridges</a>
-->
<!-- Example of buttons dropdown HTML code -->
<!--
<div class="dropdown">
<button class="dropbtn">Admin Area</button>
<div class="dropdown-content">
<a href="masters.php">Master&Peer</a>
<a href="opb.php">OpenBridge</a>
<a href="moni.php">Monitor</a>
</div>
</div>
<div class="dropdown">
<button class="dropbtn">Reflectors</button>
<div class="dropdown-content">
<a target='_blank' href="#">YSF Reflector</a>
<a target='_blank' href="#">XLX950</a>
</div>
</div>
-->
EOF
#sudo sed -i "s/opt\/FreeDMR\/freedmr.cfg/opt\/FreeDMR\/config\/FreeDMR.cfg/g" /opt/FDMR-Monitor/install.sh
sudo systemctl daemon-reload
sudo chmod +x /opt/extra-2.sh
sudo sed -i "s/root/emqte1/g" /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg
sudo sed -i "s/test/selfcare/g" /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg
sudo sed -i "s/PRIVATE_NETWORK = True/PRIVATE_NETWORK = False/g" /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg
sudo sed -i "s/TGID_URL =/#TGID_URL =/g" /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg
sed '63 a TGID_URL = https://freedmr.cymru/talkgroups/talkgroup_ids_json.php' -i /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg
sed '64 a #TGID_URL = https://freedmr.cymru/talkgroups/talkgroup_ids_flags_json.php' -i /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg
cd /opt/FDMR-Monitor/
sudo rm /opt/FDMR-Monitor/install.sh
wget https://github.com/raw/hp3icc/emq-TE1ws/main/self/install.sh
chmod +x /opt/FDMR-Monitor/install.sh
#
sh /opt/FDMR-Monitor/install.sh
######################
sudo sed -i "s/All rights reserved.<br>.*/All rights reserved.<br><a title=\"Raspbian Proyect by HP3ICC © <?php \$cdate=date(\"Y\"); if (\$cdate > \"2018\") {\$cdate=\"2018-\".date(\"Y\");} echo \$cdate; ?>\" target=\"_blank\" href=https:\/\/github.com\/hp3icc\/emq-TE1ws\/>Proyect: emq-TE1ws<\/a><br>/g" /var/www/fdmr/*.php
sudo sed -i "s/root/emqte1/g" /opt/FreeDMR/hotspot_proxy_v2.py
sudo sed -i "s/test/selfcare/g" /opt/FreeDMR/hotspot_proxy_v2.py
sudo sed -i "s/\/freedmr.cfg/\/config\/FreeDMR.cfg/g" /opt/FreeDMR/hotspot_proxy_v2.py
sudo sed -i "s/test/selfcare/g" /opt/FreeDMR/proxy_db.py
sudo sed -i "s/root/emqte1/g" /opt/FreeDMR/proxy_db.py
sudo sed -i "s/54000/54010/g" /opt/FreeDMR/hotspot_proxy_v2.py
sudo sed -i "s/54000/54010/g" /opt/FreeDMR/proxy.cfg
sudo sed -i "s/root/emqte1/g" /opt/FreeDMR/proxy.cfg
sudo sed -i "s/test/selfcare/g" /opt/FreeDMR/proxy.cfg
#################
if [ -f "/opt/FDMR-Monitor/sysinfo/tempC.rrd" ]
then
rm /opt/FDMR-Monitor/sysinfo/*.rrd
elif
[ -f "/opt/FDMR-Monitor/sysinfo/load.rrd" ]
then
rm /opt/FDMR-Monitor/sysinfo/*.rrd
elif
[ -f "/opt/FDMR-Monitor/sysinfo/hdd.rrd" ]
then
rm /opt/FDMR-Monitor/sysinfo/*.rrd
fi
sh /opt/FDMR-Monitor/sysinfo/rrd-db.sh
######################
#sed '33 a <!--' -i /var/www/html/sysinfo.php
#sed '35 a -->' -i /var/www/html/sysinfo.php
#cp -r /opt/FDMR-Monitor/sysinfo/ /var/www/html/sysinfo/
sh -c "$(curl -fsSL https://github.com/raw/hp3icc/emq-TE1ws/main/menu/menu-fdmr)"
sh -c "$(curl -fsSL https://github.com/raw/hp3icc/emq-TE1ws/main/self/data-id-update.sh)"
data-id
#sudo python3 mon_db.py
sudo systemctl daemon-reload
sudo systemctl start proxy.service
sudo systemctl enable proxy.service
sudo systemctl start fdmr_mon.service
sudo systemctl enable fdmr_mon.service
sudo systemctl start http.server-fdmr.service
sudo systemctl enable http.server-fdmr.service
sudo sh /opt/extra-2.sh