-
Notifications
You must be signed in to change notification settings - Fork 1
/
install_dvswitch.php
250 lines (168 loc) · 6.31 KB
/
install_dvswitch.php
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#!/usr/bin/php
<?php
// ------------------------------------------------------------
// (c) 2023 by WRXB288 lagmrs.com all rights reserved
// This installer sets up and installs the software.
// all software is hand coded in php from scratch
// in North Louisiana.
// -------------------------------------------------------------
//
// Notes v1.2 setup for node moved out of installer. Support for custom images
// v1.5 some bug fixes and new options
// v1.6 Auto repair added
// v1.8 Update system added( new id system phasing in)
$phpVersion= phpversion();
$path= "/etc/asterisk/local/mm-software";
$ver="v1.8"; $release="7-3-2024";
$out=""; $in=""; $skip="
";
print $skip;c641($in);sleep(2);print $skip;
$piSystem=false;if (is_readable("/proc/device-tree/model")) {$piVersion = file_get_contents ("/proc/device-tree/model");$piSystem=true;}
else {$piVersion = exec('uname -m -p');}
print "
_____ __ __ _____ _____ _ _ _ _
/ ____| \/ | __ \ / ____| (_) | | | | |
| | __| \ / | |__) | (___ _ _ __ ___| |_ __ _| | | ___ _ __
| | |_ | |\/| | _ / \___ \ | | '_ \/ __| __/ _` | | |/ _ \ '__|
| |__| | | | | | \ \ ____) | | | | | \__ \ || (_| | | | __/ |
\_____|_| |_|_| \_\_____/ |_|_| |_|___/\__\__,_|_|_|\___|_|
PHP:$phpVersion Installer:$ver Release date:$release
CPU:$piVersion
(c) 2023/2024 by WRXB288 LAGMRS.com all rights reserved
============================================================
Welcome to my PI installer. Software made in loUiSiAna.
<-Be sure you have made a backup of your memory card->
============================================================
Software will be installed to [$path]
i) install
Any other key to abort
";
$a = readline('Enter your command: ');
if ($a=="i"){
print " [Verifing ....";
$path= "/etc/asterisk/local/mm-software";
if(!is_dir($path)){ mkdir($path, 0755);}
print"-]\n";
installa($out);
chdir($path);
if (file_exists("$path/dvswitch_setup.php")){include ("$path/dvswitch_setup.php");}
else {print "Error install failed! $path/dvswitch_setup.php missing\n";}
print "
DV Switch setup added to the admin menu.
You now need to reboot to activate the admin menu.
Software Made in loUiSiAna
Thank you for downloading........... And have Many nice days
";
}
print"\n";
function installa($in){
global $docRouteP,$path;
// Dual code to be in setup_install.php and install.php
//$docRouteP
$path = "/etc/asterisk/local/mm-software";if(!is_dir($path)){ mkdir($path, 0755);}
$repoURL= "https://raw.githubusercontent.com/tmastersmart/gmrs_live/main";
$pathR = "$path/repo"; if(!is_dir($pathR)){ mkdir($pathR, 0755);}
$pathB = "$path/backup";if(!is_dir($pathB)){ mkdir($pathB, 0755);}
print"Cleaning any existing repos........\n";
chdir($pathR);clean_($pathR);
print "Downloading new repos ............\n";
exec("sudo wget $repoURL/dvswitch-download.zip",$output,$return_var);
print "Downloading finished..............\n";
chdir($pathR);
print "Unzipping and Installing..........\n";
exec("unzip $pathR/dvswitch-download.zip",$output,$return_var);
foreach (glob("*.php") as $file) {
if($file == '.' || $file == '..') continue;
if (is_file($file)) {
print"Installing php file:$path/$file ";
if (file_exists("$path/$file")){unlink("$path/$file");print"Replacing ";}// kill existing file
if (file_exists("$pathR/$file")){
rename ("$pathR/$file", "$path/$file");
exec("sudo chmod +x $path/$file",$output,$return_var);
}
print"ok\n";
}
}
foreach (glob("*.csv") as $file) {
if($file == '.' || $file == '..') continue;
if (is_file($file)) {
print"Installing csv file:$path/$file ";
if (file_exists("$path/$file")){unlink("$path/$file");print"Replacing ";}// kill existing file
if (file_exists("$pathR/$file")){rename ("$pathR/$file", "$path/$file"); }
print"ok\n";
}
}
foreach (glob("*.txt") as $file) {
if($file == '.' || $file == '..') continue;
if (is_file($file)) {
print"Installing txt file:$path/$file ";
if (file_exists("$path/$file")){unlink("$path/$file");print"Replacing ";}// kill existing file
if (file_exists("$pathR/$file")){rename ("$pathR/$file", "$path/$file"); }
print"ok\n";
}
}
admin_sh_menuI("install");
}
function admin_sh_menuI(){
global $release;
print " Installing into admin menu ";
$file ="/usr/local/sbin/firsttime/adm01-shell.sh";
$file2="/usr/local/sbin/firsttime/dvswitch.sh";
copy($file, $file2); print "-";
$formated="#/!bin/bash
#MENUFT%055%DV SWITCH Setup Program Version:$release
";
$out='
$SON
reset
php /etc/asterisk/local/mm-software/dvswitch_setup.php
exit 0
';
$out = "$formated $out";
$fileOUT = fopen($file2, "w") ;flock( $fileOUT, LOCK_EX );fwrite ($fileOUT, $out);flock( $fileOUT, LOCK_UN );fclose ($fileOUT); print "-";
exec("sudo chmod +x $file2",$output,$return_var);
if (file_exists($file2)){print"<ok>\n";}
else{print"<Error>\n";}
}
function clean_($in){
chdir($in);
foreach (glob("*.zip") as $file) {
if($file == '.' || $file == '..') continue;
if (is_file($file)) { unlink($file);print"del $file\n"; }
}
foreach (glob("*.php") as $file) {
if($file == '.' || $file == '..') continue;
if (is_file($file)) { unlink($file);print"del $file\n"; }
}
foreach (glob("*.txt") as $file) {
if($file == '.' || $file == '..') continue;
if (is_file($file)) { unlink($file);print"del $file\n"; }
}
foreach (glob("*.csv") as $file) {
if($file == '.' || $file == '..') continue;
if (is_file($file)) { unlink($file);print"del $file\n"; }
}
foreach (glob("*.ul") as $file) {
if($file == '.' || $file == '..') continue;
if (is_file($file)) { unlink($file);print"del $file\n"; }
}
foreach (glob("*.wav") as $file) {
if($file == '.' || $file == '..') continue;
if (is_file($file)) { unlink($file);print"del $file\n"; }
}
foreach (glob("*.gsm") as $file) {
if($file == '.' || $file == '..') continue;
if (is_file($file)) { unlink($file);print"del $file\n"; }
}
foreach (glob("*.diz") as $file) {
if($file == '.' || $file == '..') continue;
if (is_file($file)) { unlink($file);print"del $file\n"; }
}
}
function c641($in){
print"
**** COMODORE 64 BASIC V2 ****
64K RAM SYSTEM 38911 BASIC BYTES FREE
READY.
";
}