-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrpmgr.sh
executable file
·708 lines (676 loc) · 22.4 KB
/
frpmgr.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
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
#!/bin/bash
# /usr/local/bin/frpmgr
# author: Glucy2<[email protected]>
# repo: https://github.com/Glucy-2/frpmgr
binDict="/usr/bin/"
frpConfigType="toml"
yes=false
additionalCurlArgs=""
githubUrlPrefix=""
usage() {
echo "Usage: [sudo] frpmgr [OPTION]"
echo "Manage frp"
echo ""
echo " -h, --help display this help and exit"
echo " -i, --install install frp services"
echo " -u, --upgrade upgrade frp"
echo " -y answer yes to all questions"
echo "will enter main menu if no option is specified"
exit 0
}
checkRoot() {
[[ $EUID -ne 0 ]] && echo "This script must be run as root or using sudo" && exit 1
}
checkScriptPath() {
if [ "$(readlink -f "$0")" != "/usr/local/bin/frpmgr" ]; then
echo "WARNING: Please install this script to /usr/local/bin/frpmgr"
fi
}
checkCurl() {
if ! command -v curl &> /dev/null
then
echo "curl is not installed. Please install curl to run this script." >&2
exit 1
fi
}
checkSystemArch() {
arch=$(uname -m)
if [[ $arch == "x86_64" ]]; then
archParam="amd64"
elif [[ $arch == "arm"* ]]; then
archParam="arm"
elif [[ $arch == "aarch64" ]]; then
archParam="arm64"
elif [[ $arch == "mips" ]]; then
archParam="mips"
elif [[ $arch == "mipsle" ]]; then
archParam="mipsle"
elif [[ $arch == "mips64" ]]; then
archParam="mips64"
elif [[ $arch == "mips64le" ]]; then
archParam="mips64le"
elif [[ $arch == "riscv64" ]]; then
archParam="riscv64"
else
echo "Unsupported system architecture: $arch" 1>&2
exit 1
fi
}
checkNetwork() {
if result=$(curl -4 --max-time 5 -s https://ipinfo.io/country); then
if echo "$result" | grep -q "CN"; then
echo "Dectcted China network, will use ghproxy.net to download files from GitHub"
githubUrlPrefix="https://ghproxy.net/"
else
echo "Detected non-China network, will download files from GitHub directly"
fi
else
echo "Failed to detect IPv4 network enviroment, will use IPv6 only"
githubUrlPrefix="https://hub.gitmirror.com/"
additionalCurlArgs+=" -6"
fi
}
checkEditor() {
# shellcheck source=/dev/null
if ls "$HOME/.selected_editor" &> /dev/null; then
source "${HOME}/.selected_editor"
if [ -n "$SELECTED_EDITOR" ]; then
return
fi
fi
if command -v select-editor >/dev/null 2>&1; then
select-editor
else
read -p "No editor set in $HOME/.selected_editor, please input your preferred editor: " -r SELECTED_EDITOR
until command -v "$SELECTED_EDITOR" >/dev/null 2>&1;
do
read -p "Command $SELECTED_EDITOR not found. Please input another: " -r SELECTED_EDITOR
done
read -p "Set $SELECTED_EDITOR as your default editor? [Y/n]" -r
if [[ $REPLY =~ ^[Yy]?$ ]]; then
echo "SELECTED_EDITOR=\"$SELECTED_EDITOR\"" > "$HOME/.selected_editor"
fi
fi
# shellcheck source=/dev/null
source "${HOME}/.selected_editor"
}
checkLatestFrpVersion() {
echo "Checking for latest frp version..."
checkUrl="${githubUrlPrefix}https://github.com/fatedier/frp/releases/latest"
# shellcheck disable=SC2086
latestFrpVersion=$(curl ${additionalCurlArgs} -s -I "$checkUrl" | awk -F'/' '/location: /{print $NF}' | grep -oE "[0-9]+\.[0-9]+\.[0-9]+" | tail -1)
echo "Latest frp version is $latestFrpVersion"
}
installServices() {
echo "Installing frp services..."
mkdir -p /etc/frp
skip=false
if ls /usr/lib/systemd/system/frpc.service &> /dev/null; then
read -p "/usr/lib/systemd/system/frpc.service already exists, overwrite it? [Y/n]" -r
if [[ $yes == true || $REPLY =~ ^[Yy]?$ ]]; then
rm -f /usr/lib/systemd/system/frpc.service
else
skip=true
fi
fi
if [[ $skip != true ]]; then
cat << EOF > /usr/lib/systemd/system/frpc.service
[Unit]
Description=Frp Client Service
After=network.target
Wants=network.target
[Service]
Type=simple
DynamicUser=yes
Restart=always
RestartSec=5s
ExecStart=${binDict}frpc -c /etc/frp/frpc.${frpConfigType}
ExecReload=${binDict}frpc reload -c /etc/frp/frpc.${frpConfigType}
[Install]
WantedBy=multi-user.target
EOF
echo "Use /etc/frp/frpc.${frpConfigType} as config file for frpc.service"
fi
skip=false
read -p "/usr/lib/systemd/system/[email protected] already exists, overwrite it? [Y/n]" -r
if [[ $yes == true || $REPLY =~ ^[Yy]?$ ]]; then
rm -f /usr/lib/systemd/system/[email protected]
else
skip=true
fi
fi
if [[ $skip != true ]]; then
cat << EOF > /usr/lib/systemd/system/[email protected]
[Unit]
Description=Frp Client Service for %i
After=network.target
Wants=network.target
[Service]
Type=simple
DynamicUser=yes
Restart=always
RestartSec=5s
ExecStart=${binDict}frpc -c /etc/frp/%i.${frpConfigType}
ExecReload=${binDict}frpc reload -c /etc/frp/%i.${frpConfigType}
[Install]
WantedBy=multi-user.target
EOF
echo "Use /etc/frp/xxxx.${frpConfigType} as config file for [email protected]"
fi
skip=false
if ls /usr/lib/systemd/system/frps.service &> /dev/null; then
read -p "/usr/lib/systemd/system/frps.service already exists, overwrite it? [Y/n]" -r
if [[ $yes == true || $REPLY =~ ^[Yy]?$ ]]; then
rm -f /usr/lib/systemd/system/frps.service
else
skip=true
fi
fi
if [[ $skip != true ]]; then
cat << EOF > /usr/lib/systemd/system/frps.service
[Unit]
Description=Frp Server Service
After=network.target
Wants=network.target
[Service]
Type=simple
DynamicUser=yes
Restart=always
RestartSec=5s
ExecStart=${binDict}frps -c /etc/frp/frps.${frpConfigType}
ExecReload=${binDict}frps reload -c /etc/frp/frps.${frpConfigType}
[Install]
WantedBy=multi-user.target
EOF
echo "Use /etc/frp/frps.${frpConfigType} as config file for frps.service"
fi
skip=false
read -p "/usr/lib/systemd/system/[email protected] already exists, overwrite it? [Y/n]" -r
if [[ $yes == true || $REPLY =~ ^[Yy]?$ ]]; then
rm -f /usr/lib/systemd/system/[email protected]
else
skip=true
fi
fi
if [[ $skip != true ]]; then
cat << EOF > /usr/lib/systemd/system/[email protected]
[Unit]
Description=Frp Server Service for %i
After=network.target
Wants=network.target
[Service]
Type=simple
DynamicUser=yes
Restart=always
RestartSec=5s
ExecStart=${binDict}frps -c /etc/frp/%i.${frpConfigType}
ExecReload=${binDict}frps reload -c /etc/frp/%i.${frpConfigType}
[Install]
WantedBy=multi-user.target
EOF
echo "Use /etc/frp/xxxx.${frpConfigType} as config file for [email protected]"
fi
systemctl daemon-reload
read -p "Set a timer to automatically check for updates every day at 4:00? [Y/n]" -r
if [[ $yes == true || $REPLY =~ ^[Yy]?$ ]]; then
cat << EOF > /usr/lib/systemd/system/upgrade-frp.timer
[Unit]
Description=Timer for upgrading frp
[Timer]
OnCalendar=*-*-* 04:00:00
Persistent=true
[Install]
WantedBy=timers.target
EOF
cat << EOF > /usr/lib/systemd/system/upgrade-frp.service
[Unit]
Description=Service for upgrading frp
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/frpmgr -u -y
EOF
systemctl daemon-reload
read -p "Enable the timer now? [Y/n]" -r
[[ $yes == true || $REPLY =~ ^[Yy]?$ ]] && systemctl enable --now upgrade-frp.timer
fi
}
downloadFrp(){
fileName="frp_${latestFrpVersion}_linux_${archParam}.tar.gz"
downloadUrl="${githubUrlPrefix}https://github.com/fatedier/frp/releases/download/v${latestFrpVersion}/${fileName}"
checksumsUrl="${githubUrlPrefix}https://github.com/fatedier/frp/releases/download/v${latestFrpVersion}/frp_sha256_checksums.txt"
echo "Downloading frp_sha256_checksums.txt..."
i=0
while [ $i -le 3 ];
do
# shellcheck disable=SC2086
if sha256=$(curl ${additionalCurlArgs} -fSL "$checksumsUrl" | grep -E "^([a-fA-F0-9]{64}) +$fileName" | awk '{print $1}'); then
break
fi
if [ $i -ge 3 ]; then
echo "frp_sha256_checksums.txt download failed too many times, exiting..."
exit 1
else
echo "frp_sha256_checksums.txt download failed, trying again..."
((i++))
fi
done
tempFile=$(mktemp)
echo "Downloading $fileName..."
i=0
while [ $i -le 3 ];
do
# shellcheck disable=SC2086
curl ${additionalCurlArgs} -fSL "$downloadUrl" -o "$tempFile"
if [ "$(sha256sum "$tempFile" | cut -d ' ' -f 1)" == "$sha256" ]; then
break
fi
if [ $i -ge 3 ]; then
echo "sha256sum of downloaded file does not match, exiting..."
exit 1
else
echo "sha256sum of downloaded file does not match, trying again..."
((i++))
fi
done
}
upgradeFrp() {
mkdir -p /etc/frp
checkLatestFrpVersion
if [ "$(${binDict}frps -v 2> /dev/null)" != "$latestFrpVersion" ]; then
read -p "frps is not updated or installed, install latest version? [Y/n]" -r
if [[ $yes == true || $REPLY =~ ^[Yy]?$ ]]; then
installFrps=true
fi
else
echo "frpc is already the latest version"
fi
if [ "$(${binDict}frpc -v 2> /dev/null)" != "$latestFrpVersion" ]; then
read -p "frpc is not updated or installed, install latest version? [Y/n]" -r
if [[ $yes == true || $REPLY =~ ^[Yy]?$ ]]; then
installFrpc=true
fi
else
echo "frpc is already the latest version"
fi
if [[ $installFrps == true ]] || [[ $installFrpc == true ]]; then
downloadFrp
fi
if [[ $installFrps == true ]]; then
tar -xzf "$tempFile" -C "$binDict" --strip-components=1 "frp_${latestFrpVersion}_linux_${archParam}/frps"
echo -e "Installed frps version: $("$binDict"frps -v)"
# Uncomment the following lines if you want to restart running frps services after upgrade
# WARNING: This can break you services if there are breaking changes in new frp version
# if systemctl is-active --quiet frps; then
# systemctl restart frps.service
# fi
# systemctl list-units -t service --state running --all --full --no-legend frps@* | awk '{print $1}' | xargs -I {} systemctl restart {}
fi
if [[ $installFrpc == true ]]; then
tar -xzf "$tempFile" -C "$binDict" --strip-components=1 "frp_${latestFrpVersion}_linux_${archParam}/frpc"
echo -e "Installed frpc version: $("$binDict"frpc -v)"
# Uncomment the following lines if you want to restart running frpc services after upgrade
# WARNING: This can break you services if there are breaking changes in new frp version
# if systemctl is-active --quiet frpc; then
# systemctl restart frpc.service
# fi
# systemctl list-units -t service --state running --all --full --no-legend frpc@* | awk '{print $1}' | xargs -I {} systemctl restart {}
fi
}
manageFrp() {
multiconfigMode=false
while :
do
echo "What to manage?"
echo "[0] Back"
echo "[1] frps"
echo "[2] frpc"
read -p "Your option: " -r option
case "$option" in
0)
return 0
;;
1)
manage="frps"
;;
2)
manage="frpc"
;;
*)
echo "Invalid input"
;;
esac
while :
do
echo "MENU:"
if [[ $multiconfigMode == false ]]; then
echo "[ 0] Back"
echo "[ 1] Switch to multi config mode"
echo "[ 2] Show $manage service status"
echo "[ 3] View $manage service logs in reverse order"
echo "[ 4] View $manage service real-time logs"
echo "[ 5] Restart $manage service"
echo "[ 6] Start $manage service"
echo "[ 7] Stop $manage service"
echo "[ 8] Reload $manage service"
echo "[ 9] Enable $manage service"
echo "[10] Disable $manage service"
read -p "Your option: " -r option
case "$option" in
0)
break
;;
1)
multiconfigMode=true
;;
2)
systemctl status "$manage"
;;
3)
journalctl -u "$manage" -r
;;
4)
journalctl -u "$manage" -f
;;
5)
read -p "Will restart $manage service, continue? [Y/n]" -r
if [[ $REPLY =~ ^[Yy]?$ ]]; then
systemctl restart "$manage"
fi
;;
6)
read -p "Will start $manage service, continue? [Y/n]" -r
if [[ $REPLY =~ ^[Yy]?$ ]]; then
systemctl start "$manage"
fi
;;
7)
read -p "Will stop $manage service, continue? [Y/n]" -r
if [[ $REPLY =~ ^[Yy]?$ ]]; then
systemctl stop "$manage"
fi
;;
8)
read -p "Will reload $manage services, continue? [Y/n]" -r
if [[ $REPLY =~ ^[Yy]?$ ]]; then
systemctl reload "$manage"
fi
;;
9)
systemctl enable "$manage"
;;
10)
systemctl disable "$manage"
;;
*)
echo "Invalid input"
;;
esac
else
echo "[ 0] Back"
echo "[ 1] Switch to single config mode"
echo "[ 2] Show all $manage services status"
echo "[ 3] View logs of a $manage service in reverse order"
echo "[ 4] View real-time logs of a $manage service"
echo "[ 5] Restart a $manage service"
echo "[ 6] Start a $manage service"
echo "[ 7] Stop a $manage service"
echo "[ 8] Reload a $manage service"
echo "[ 9] Enable a $manage service"
echo "[10] Disable a $manage service"
echo "[11] Restart all $manage services"
echo "[12] Start all $manage services"
echo "[13] Stop all $manage services"
echo "[14] Reload all $manage services"
echo "[15] Enable all $manage services"
echo "[16] Disable all $manage services"
echo ""
echo "Note: all $manage services mean $manage@*.service, "
echo " don't include $manage.service"
read -p "Your option: " -r option
case "$option" in
0)
break
;;
1)
multiconfigMode=false
;;
2)
systemctl list-units -t service --all --full "$manage@*"
;;
3)
read -p "Input service name: $manage@" -r serviceName
journalctl -u "$manage@$serviceName" -r
;;
4)
read -p "Input service name: $manage@" -r serviceName
journalctl -u "$manage@$serviceName" -f
;;
5)
read -p "Input service name: $manage@" -r serviceName
read -p "Will restart $manage@${serviceName}, continue? [Y/n]" -r
[[ $REPLY =~ ^[Yy]?$ ]] && systemctl restart "$manage@$serviceName"
;;
6)
read -p "Input service name: $manage@" -r serviceName
read -p "Will start $manage@${serviceName}, continue? [Y/n]" -r
[[ $REPLY =~ ^[Yy]?$ ]] && systemctl start "$manage@$serviceName"
;;
7)
read -p "Input service name: $manage@" -r serviceName
read -p "Will stop $manage@${serviceName}, continue? [Y/n]" -r
[[ $REPLY =~ ^[Yy]?$ ]] && systemctl stop "$manage@$serviceName"
;;
8)
read -p "Input service name: $manage@" -r serviceName
read -p "Will reload $manage@${serviceName}, continue? [Y/n]" -r
[[ $REPLY =~ ^[Yy]?$ ]] && systemctl reload "$manage@$serviceName"
;;
9)
read -p "Input service name: $manage@" -r serviceName
systemctl enable "$manage@$serviceName"
;;
10)
read -p "Input service name: $manage@" -r serviceName
systemctl disable "$manage@$serviceName"
;;
11)
read -p "Will restart all $manage services, continue? [Y/n]" -r
[[ $REPLY =~ ^[Yy]?$ ]] && systemctl restart "$manage@*"
;;
12)
read -p "Will start all $manage services, continue? [Y/n]" -r
[[ $REPLY =~ ^[Yy]?$ ]] && systemctl start "$manage@*"
;;
13)
read -p "Will stop all $manage services, continue? [Y/n]" -r
[[ $REPLY =~ ^[Yy]?$ ]] && systemctl stop "$manage@*"
;;
14)
read -p "Will reload all $manage services, continue? [Y/n]" -r
[[ $REPLY =~ ^[Yy]?$ ]] && systemctl reload "$manage@*"
;;
15)
read -p "Will enable all $manage services, continue? [Y/n]" -r
[[ $REPLY =~ ^[Yy]?$ ]] && systemctl enable "$manage@*"
;;
16)
read -p "Will disable all $manage services, continue? [Y/n]" -r
[[ $REPLY =~ ^[Yy]?$ ]] && systemctl disable "$manage@*"
;;
*)
echo "Invalid input"
;;
esac
fi
done
done
}
manage() {
frpsVersion=$(${binDict}frps -v 2>/dev/null)
frpcVersion=$(${binDict}frpc -v 2>/dev/null)
if [ -z "$frpsVersion" ] && [ -z "$frpsVersion" ]; then
read -p "Neither frps and frpc are not installed in ${binDict}, install now? [Y/n]" -r
if [[ $yes == true || $REPLY =~ ^[Yy]?$ ]]; then
upgradeFrp
frpsVersion=$(${binDict}frps -v 2>/dev/null)
frpcVersion=$(${binDict}frpc -v 2>/dev/null)
fi
fi
if [ -z "$frpsVersion" ]; then
echo "frps is not installed"
else
echo "Installed frps version: $frpsVersion"
fi
if [ -z "$frpsVersion" ]; then
echo "frpc is not installed"
else
echo "Installed frpc version: $frpcVersion"
fi
checkLatestFrpVersion
while :
do
echo "MENU:"
echo "[0] Exit"
echo "[1] Manage frp"
echo "[2] Install/Upgrade frp"
echo "[3] Install frp services"
echo "[4] Enable frp auto-upgrade timer"
echo "[5] Disable frp auto-upgrade timer"
echo "[6] Edit/Create a frp config file"
echo "[7] Edit a frp service file"
echo "[8] Uninstall services"
echo "[9] Uninstall frp"
read -p "Your option: " -r option
case "$option" in
0)
exit 0
;;
1)
manageFrp
;;
2)
upgradeFrp
;;
3)
installServices
;;
4)
systemctl enable --now upgrade-frp.timer
;;
5)
systemctl disable --now upgrade-frp.timer
;;
6)
echo "Tips:"
echo "1. default config suffix is .${frpConfigType}"
echo "2. use Tab to autocomplete file name"
read -e -i "/etc/frp/" -p "Input config name: " -r fileName
"$SELECTED_EDITOR" "$fileName"
;;
7)
echo "MENU:"
echo "[0] Back"
echo "[1] frps.service"
echo "[2] [email protected]"
echo "[3] frpc.service"
echo "[4] [email protected]"
read -p "Your option: " -r option
case "$option" in
0)
break
;;
1)
"$SELECTED_EDITOR" /usr/lib/systemd/system/frps.service
;;
2)
"$SELECTED_EDITOR" /usr/lib/systemd/system/[email protected]
;;
3)
"$SELECTED_EDITOR" /usr/lib/systemd/system/frpc.service
;;
4)
"$SELECTED_EDITOR" /usr/lib/systemd/system/[email protected]
;;
*)
echo "Invalid input"
;;
esac
;;
8)
read -p "Uninstall frp services? [Y/n]" -r
if [[ $REPLY =~ ^[Yy]?$ ]]; then
systemctl disable --now frps
systemctl disable --now frps@*
systemctl disable --now frpc
systemctl disable --now frpc@*
rm -f /usr/lib/systemd/system/frpc.service
rm -f /usr/lib/systemd/system/[email protected]
rm -f /usr/lib/systemd/system/frps.service
rm -f /usr/lib/systemd/system/[email protected]
systemctl daemon-reload
fi
;;
9)
read -p "Uninstall frp? [Y/n]" -r
if [[ $REPLY =~ ^[Yy]?$ ]]; then
rm -f ${binDict}frpc
rm -f ${binDict}frps
fi
;;
*)
echo "Invalid input"
;;
esac
done
}
echo ' ____ '
echo ' / __/________ ____ ___ ____ ______'
# shellcheck disable=SC2016
echo ' / /_/ ___/ __ \/ __ `__ \/ __ `/ ___/'
echo ' / __/ / / /_/ / / / / / / /_/ / / '
echo '/_/ /_/ / .___/_/ /_/ /_/\__, /_/ '
echo ' /_/ /____/ '
echo ' frpmgr - frp manager '
echo 'repo: https://github.com/Glucy-2/frpmgr'
echo 'author: Glucy2<[email protected]> '
echo ''
echo 'Initiating...'
checkScriptPath
while getopts 'yihu' arg;
do
case $arg in
h)
usage
;;
i)
checkRoot
installServices
exit 0
;;
u)
checkRoot
checkCurl
checkSystemArch
checkInChina
upgradeFrp
exit 0
;;
y)
yes=true
;;
?)
echo "Invalid argument. Check usage by $0 -h" 1>&2
exit 1
;;
esac
done
checkRoot
checkCurl
checkSystemArch
checkNetwork
checkEditor
manage