-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathetc-config.sh
More file actions
189 lines (181 loc) · 7.14 KB
/
Copy pathetc-config.sh
File metadata and controls
189 lines (181 loc) · 7.14 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
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
#! /bin/sh
function _func_BUTTON {
while :
do
echo -e " \033[1;34mDownload button configuration and installation scripts\033[0;39m"
read -p " Please select key [y/n]: " num
case "${num}" in
"y" ) wget --no-check-certificate -O /etc/config-software/button-config.sh https://raw.githubusercontent.com/site-u2023/config-software/main/button-config.sh
sh /etc/config-software/button-config.sh
break ;;
"n" ) break ;;
esac
done
}
function _func_IPERF3 {
while :
do
echo -e " \033[1;33mDownload and install IPERF3 configuration script\033[0;39m"
echo -e " \033[1;33mDUMP not supported\033[0;39m"
read -p " Please select key [y/n]: " num
case "${num}" in
"y" ) wget --no-check-certificate -O /etc/init.d/iperf3 https://raw.githubusercontent.com/site-u2023/iperf/main/iperf3
chmod +x /etc/init.d/iperf3
OPENWRT_RELEAS=$(grep 'DISTRIB_RELEASE' /etc/openwrt_release | cut -d"'" -f2 | cut -c 1-2)
if [[ "${OPENWRT_RELEAS}" = "24" || "${OPENWRT_RELEAS}" = "23" || "${OPENWRT_RELEAS}" = "22" || "${OPENWRT_RELEAS}" = "21" || "${OPENWRT_RELEAS}" = "19" ]]; then
opkg update
opkg install iperf3
elif [[ "${OPENWRT_RELEAS}" = "SN" ]]; then
apk update
apk add iperf3
exit
fi
NET_IF="lan"
. /lib/functions/network.sh
network_flush_cache
network_get_ipaddr NET_ADDR "${NET_IF}"
sed -i -e "s/192.168.1.1/${NET_ADDR}/g" /etc/init.d/iperf3
echo -e " \033[1;32mInstallation is complete\033[0;39m"
echo -e " \033[1;36mEnable: service iperf3 enable\033[0;39m"
echo -e " \033[1;36mDisable: service iperf3 disable\033[0;39m"
echo -e " \033[1;36mStart: service iperf3 start\033[0;39m"
echo -e " \033[1;36mStop: service iperf3 stop\033[0;39m"
read -p " Start service [y/n]: " snum
case "${snum}" in
"y" ) echo -e " \033[1;36mStart IPERF3\033[0;39m"
service iperf3 start ;;
"n" ) break ;;
esac
read -p " Press any key"
break ;;
"n" ) break ;;
esac
done
}
function _func_WiFi_location_service {
OPENWRT_RELEAS=$(grep 'DISTRIB_RELEASE' /etc/openwrt_release | cut -d"'" -f2 | cut -c 1-2)
if [[ "${OPENWRT_RELEAS}" = "24" || "${OPENWRT_RELEAS}" = "23" || "${OPENWRT_RELEAS}" = "22" || "${OPENWRT_RELEAS}" = "21" || "${OPENWRT_RELEAS}" = "19" ]]; then
echo -e " The version of this device is \033[1;33m$OPENWRT_RELEAS\033[0;39m"
echo -e " Version Check: \033[1;36mOK\033[0;39m"
else
read -p " Exit due to different versions"
exit
fi
while :
do
echo -e " \033[1;32mExecute Location Based Service (LBS) stop setting\033[0;39m"
echo -e " \033[1;32mAdd _optout_nomap to the SSID name\033[0;39m"
read -p " Please select key [y/n]: " num
case "${num}" in
"y" ) sed -i -e 's/\s*$//' /etc/config/wireless
sed -i -e "/option ssid/s/'$//" /etc/config/wireless
sed -i -e "/option ssid/s/$/_optout_nomap'/g" /etc/config/wireless
/etc/init.d/network restart
break ;;
"n" ) break ;;
esac
done
}
function _func_SAMBA4 {
while :
do
echo -e " \033[1;32mPerform SAMBA4 and WSDD2 installation\033[0;39m"
read -p " Please select key [y/n]: " num
case "${num}" in
"y" ) OPENWRT_RELEAS=$(grep 'DISTRIB_RELEASE' /etc/openwrt_release | cut -d"'" -f2 | cut -c 1-2)
if [[ "${OPENWRT_RELEAS}" = "24" || "${OPENWRT_RELEAS}" = "23" || "${OPENWRT_RELEAS}" = "22" || "${OPENWRT_RELEAS}" = "21" || "${OPENWRT_RELEAS}" = "19" ]]; then
opkg update
opkg install luci-app-samba4 wsdd2
elif [[ "${OPENWRT_RELEAS}" = "SN" ]]; then
apk update
apk add luci-app-samba4 wsdd2
exit
fi
/etc/init.d/samba4 enable
/etc/init.d/samba4 start
read -p " Press any key"
break ;;
"n" ) break ;;
esac
done
}
function _func_DFS {
OPENWRT_RELEAS=$(grep 'DISTRIB_RELEASE' /etc/openwrt_release | cut -d"'" -f2 | cut -c 1-2)
if [[ "${OPENWRT_RELEAS}" = "24" || "${OPENWRT_RELEAS}" = "23" || "${OPENWRT_RELEAS}" = "22" || "${OPENWRT_RELEAS}" = "21" || "${OPENWRT_RELEAS}" = "19" ]]; then
echo -e " The version of this device is \033[1;33m$OPENWRT_RELEAS\033[0;39m"
echo -e " Version Check: \033[1;36mOK\033[0;39m"
else
read -p " Exit due to different versions"
exit
fi
while :
do
echo -e " \033[1;33mDownload and install ZZDFS configuration script\033[0;39m"
echo -e " \033[1;34m[b]: ZZDFS\033[0;39m"
read -p " Please select key [d or n]: " num
case "${num}" in
"d" ) wget --no-check-certificate -O /etc/config-software/zzdfs-config.sh https://raw.githubusercontent.com/site-u2023/config-software/main/zzdfs-config.sh
sh /etc/config-software/zzdfs-config.sh 2> /dev/null
service dfs_check enable
service dfs_check start
echo "Check your Wi-Fi settings"
echo "How to check logs: dfslog"
read -p " Press any key"
break ;;
"n" ) break ;;
esac
done
}
function _func_GUEST {
OPENWRT_RELEAS=$(grep 'DISTRIB_RELEASE' /etc/openwrt_release | cut -d"'" -f2 | cut -c 1-2)
if [[ "${OPENWRT_RELEAS}" = "24" || "${OPENWRT_RELEAS}" = "23" || "${OPENWRT_RELEAS}" = "22" || "${OPENWRT_RELEAS}" = "21" || "${OPENWRT_RELEAS}" = "19" ]]; then
echo -e " The version of this device is \033[1;33m$OPENWRT_RELEAS\033[0;39m"
echo -e " Version Check: \033[1;36mOK\033[0;39m"
else
read -p " Exit due to different versions"
exit
fi
while :
do
echo -e " \033[1;32mGuest Wi-Fi installation\033[0;39m"
read -p " Please select key [y/n]: " num
case "${num}" in
"y" ) opkg update
opkg install bash
opkg install openssl-util
opkg install qrencode
opkg install at
wget --no-check-certificate -O /etc/config-software/guest.sh https://raw.githubusercontent.com/site-u2023/config-software/main/guest.sh
bash /etc/config-software/guest.sh 2> /dev/null
service wifi_guest start
HOSTMANE=`uci get system.@system[0].hostname`
echo -e " \033[1;32mGuest Wi-Fi: http://${HOSTMANE}/guest.html\033[0;39m"
echo -e " \033[1;32mQR code: http://${HOSTMANE}/qr.svg\033[0;39m"
read -p " Press any key"
break ;;
"n" ) break ;;
esac
done
}
while :
do
echo -e " \033[1;37mETC -------------------------------------------------\033[0;39m"
echo -e " \033[1;34m[1]:Button Setup and Installation\033[0;39m"
echo -e " \033[1;33m[2]:IPERF3 installation and service addition\033[0;39m"
echo -e " \033[1;32m[3]:Location Based Service (LBS) Stop\033[0;39m"
echo -e " \033[1;35m[4]:SAMBA4 and WSDD2 installation\033[0;39m"
echo -e " \033[1;31m[5]:ZZDFS\033[0;39m"
echo -e " \033[1;36m[6]:Guest Wi-Fi\033[0;39m"
echo -e " \033[7;40m[q]:Quit\033[0;39m"
echo -e " \033[1;37m-----------------------------------------------------\033[0;39m"
read -p " Please select key [1/2/3/4/5 or q]: " num
case "${num}" in
"1" ) _func_BUTTON ;;
"2" ) _func_IPERF3 ;;
"3" ) _func_WiFi_location_service ;;
"4" ) _func_SAMBA4 ;;
"5" ) _func_DFS ;;
"6" ) _func_GUEST ;;
"q" ) exit ;;
esac
done