blob: 303a075f018d5b75a813a128866de47954d38fb6 [file] [log] [blame]
you.chenc9928582023-04-24 15:39:37 +08001#!/bin/sh
2
3for ((i=0; i < 10; i++)); do
4 state=`systemctl is-active wg870_drv_insmod.service`
5 if [ "$state" == "active" ]; then
6 break
7 elif [ "$state" != "activating" ]; then
8
9 systemctl start wg870_drv_insmod.service
10 fi
11 usleep 100000
12done
13
14if [ "$state" != "active" ]; then
15 exit 1
16fi
17
18for ((i=0; i < 10; i++)); do
19 connmanctl technologies | grep -q "/net/connman/technology/wifi"
20 if [ $? == 0 ]; then
21 connman_started=1
22 break
23 fi
24done
25
26if [ "$connman_started" == ""]; then
27 exit 2
28fi
29
30ifconfig | grep -q wlan0
31
32if [ $? != 0 ]; then
33 connmanctl enable wifi
34
35 for ((i=0; i < 5; i++)); do
36 usleep 100000
37 ifconfig | grep -q wlan0
38 if [ $? == 0 ]; then
39 wlan0_started=1
40 wpa_cli -iwpa_wlan0_cmd -p/var/run/ IFNAME=wlan0 disconnect
41 break
42 fi
43 done
44else
45 wlan0_started=1
46fi
47
48
49if [ "$wlan0_started" == ""]; then
50 exit 3
51fi
52
53ifconfig | grep -q ap0
54
55if [ $? != 0 ]; then
56 wpa_cli -iwpa_wlan0_cmd -p/var/run/ IFNAME=wlan0 DRIVER interface_create ap0
57 connmanctl tether wifi on lynq 1qaz@WSX#$%^
58
59 for ((i=0; i < 5; i++)); do
60 usleep 100000
61 ifconfig | grep -q ap0
62 if [ $? == 0 ]; then
63 ap0_started=1
64 wpa_cli -iwpa_wlan0_cmd -p/var/run/ IFNAME=ap0 disconnect
65 break
66 fi
67 done
68else
69 ap0_started=1
70fi
71
72
73if [ "$ap0_started" == ""]; then
74 exit 4
75fi
76