xf.li | 8611891 | 2025-03-19 20:07:27 -0700 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | ## |
| 3 | # $Id: zxic_qrcode_create.sh,v 0.0.0.1 2013.05.06 liuweipeng Exp $ |
| 4 | # |
| 5 | # usage: zxic_qrcode_create.sh |
| 6 | # |
| 7 | |
| 8 | #wifi_ssid_qrcode_name='/usr/zte_web/web/img/qrcode_ssid_wifikey.png' |
| 9 | #wifi_ssid_qrcode_name_bmp='/usr/zte/zte_conf/mmi/mmi_image/ssid_wifikey.bmp' |
| 10 | |
| 11 | #multi_wifi_ssid_qrcode_name='/usr/zte_web/web/img/qrcode_multi_ssid_wifikey.png' |
| 12 | #multi_wifi_ssid_qrcode_name_bmp='/usr/zte/zte_conf/mmi/mmi_image/multi_ssid_wifikey.bmp' |
| 13 | |
| 14 | #local_domain_qrcode_name='/usr/zte_web/web/img/qrcode_local_domaind.png' |
| 15 | #local_domain_qrcode_name_bmp='/usr/zte/zte_conf/mmi/mmi_image/local_domaind.bmp' |
| 16 | |
| 17 | ROOT=`nv get wifi_root_dir` |
| 18 | |
| 19 | wifi_ssid_qrcode_name="$ROOT/wifi/qrcode_ssid_wifikey.png" |
| 20 | wifi_ssid_qrcode_name_bmp="$ROOT/wifi/ssid_wifikey.bmp" |
| 21 | |
| 22 | wifi_5g_ssid_qrcode_name="$ROOT/wifi/qrcode_ssid_wifikey_5g.png" |
| 23 | wifi_5g_ssid_qrcode_name_bmp="$ROOT/wifi/ssid_wifikey_5g.bmp" |
| 24 | |
| 25 | multi_wifi_ssid_qrcode_name="$ROOT/wifi/qrcode_multi_ssid_wifikey.png" |
| 26 | multi_wifi_ssid_qrcode_name_bmp="$ROOT/wifi/multi_ssid_wifikey.bmp" |
| 27 | |
| 28 | local_domain_qrcode_name="$ROOT/wifi/qrcode_local_domaind.png" |
| 29 | local_domain_qrcode_name_bmp="$ROOT/wifi/local_domaind.bmp" |
| 30 | |
| 31 | #for luci |
| 32 | target_web_dir="/www/luci-static/resources/icons/" |
| 33 | #for vue |
| 34 | target_vue_web_dir="/etc_ro/web/icons/" |
| 35 | |
| 36 | |
| 37 | echo "wifi_ssid_qrcode_name=$wifi_ssid_qrcode_name" |
| 38 | echo "wifi_ssid_qrcode_name_bmp=$wifi_ssid_qrcode_name_bmp" |
| 39 | ############zte qrcode create shell entry################# |
| 40 | |
| 41 | case $1 in |
| 42 | "wifi_create") |
| 43 | |
| 44 | echo "enter the wifi_create function" |
| 45 | |
| 46 | rm -rf $wifi_ssid_qrcode_name |
| 47 | rm -rf $wifi_ssid_qrcode_name_bmp |
| 48 | |
| 49 | #wifi_ssid_name=`zte_nvc_apps read SSID1` # wifi ssid |
| 50 | #wifi_auth_mode=`zte_nvc_apps read AuthMode` # wifi auth mode |
| 51 | #wifi_encry_type=`zte_nvc_apps read EncrypType` #wifi encry type |
| 52 | #wifi_password=`zte_nvc_apps read WPAPSK1` #wifi password |
| 53 | wifi_ssid_name=`nv get SSID1` # wifi ssid |
| 54 | wifi_auth_mode=`nv get AuthMode` # wifi auth mode |
| 55 | wifi_encry_type=`nv get EncrypType` # wifi encry type |
| 56 | auth_wpa=`echo $wifi_auth_mode | sed -n '/WPA/p'` |
| 57 | auth_wpa_1=`echo $wifi_auth_mode | sed -n '/WPA3/p'` |
| 58 | if [ -n "$auth_wpa" ];then # wpa |
| 59 | wifi_password=`nv get WPAPSK1` # wifi password |
| 60 | if [ -n "$auth_wpa_1" ];then |
| 61 | wifi_T="SAE" |
| 62 | else |
| 63 | wifi_T="WPA" |
| 64 | fi |
| 65 | qrcode_text='WIFI:T:'$wifi_T';S:'$wifi_ssid_name';P:'$wifi_password';' |
| 66 | echo "qrcode_text = $qrcode_text" |
| 67 | elif [ "$wifi_encry_type" = "WEP" -o "$wifi_auth_mode" = "SHARED" -o "$wifi_auth_mode" = "WEPAUTO" ];then |
| 68 | defaultKeyID=`nv get DefaultKeyID` |
| 69 | if [ "$defaultKeyID" = "0" ];then |
| 70 | wifi_password=`nv get Key1Str1` |
| 71 | elif [ "$defaultKeyID" = "1" ];then |
| 72 | wifi_password=`nv get Key2Str1` |
| 73 | elif [ "$defaultKeyID" = "2" ];then |
| 74 | wifi_password=`nv get Key3Str1` |
| 75 | elif [ "$defaultKeyID" = "3" ];then |
| 76 | wifi_password=`nv get Key4Str1` |
| 77 | else |
| 78 | wifi_password=`nv get Key1Str1` |
| 79 | fi |
| 80 | qrcode_text='WIFI:T:WEP;S:'$wifi_ssid_name';P:'$wifi_password';' |
| 81 | echo "qrcode_text = $qrcode_text" |
| 82 | elif [ "$wifi_encry_type" = "NONE" ];then |
| 83 | qrcode_text='WIFI:S:'$wifi_ssid_name';' |
| 84 | echo "qrcode_text = $qrcode_text" |
| 85 | fi |
| 86 | |
| 87 | qrencode -o $wifi_ssid_qrcode_name -m 10 -s 2 "$qrcode_text" |
| 88 | png2bmp -O $wifi_ssid_qrcode_name_bmp $wifi_ssid_qrcode_name |
| 89 | |
| 90 | cp $wifi_ssid_qrcode_name $target_web_dir |
| 91 | cp $wifi_ssid_qrcode_name $target_vue_web_dir |
| 92 | |
| 93 | #5g |
| 94 | rm -rf $wifi_5g_ssid_qrcode_name |
| 95 | rm -rf $wifi_5g_ssid_qrcode_name_bmp |
| 96 | |
| 97 | #wifi_ssid_name=`zte_nvc_apps read SSID1` # wifi ssid |
| 98 | #wifi_auth_mode=`zte_nvc_apps read AuthMode` # wifi auth mode |
| 99 | #wifi_encry_type=`zte_nvc_apps read EncrypType` #wifi encry type |
| 100 | #wifi_password=`zte_nvc_apps read WPAPSK1` #wifi password |
| 101 | wifi_ssid_name=`nv get SSID1_5g` # wifi ssid |
| 102 | wifi_auth_mode=`nv get AuthMode_5g` # wifi auth mode |
| 103 | wifi_encry_type=`nv get EncrypType_5g` # wifi encry type |
| 104 | auth_wpa=`echo $wifi_auth_mode | sed -n '/WPA/p'` |
| 105 | auth_wpa_1=`echo $wifi_auth_mode | sed -n '/WPA3/p'` |
| 106 | if [ -n "$auth_wpa" ];then # wpa |
| 107 | wifi_password=`nv get WPAPSK1_5g` # wifi password |
| 108 | if [ -n "$auth_wpa_1" ];then |
| 109 | wifi_T="SAE" |
| 110 | else |
| 111 | wifi_T="WPA" |
| 112 | fi |
| 113 | qrcode_text='WIFI:T:'$wifi_T';S:'$wifi_ssid_name';P:'$wifi_password';' |
| 114 | echo "qrcode_text = $qrcode_text" |
| 115 | elif [ "$wifi_encry_type" = "WEP" -o "$wifi_auth_mode" = "SHARED" -o "$wifi_auth_mode" = "WEPAUTO" ];then |
| 116 | defaultKeyID=`nv get DefaultKeyID_5g` |
| 117 | if [ "$defaultKeyID" = "0" ];then |
| 118 | wifi_password=`nv get Key1Str1_5g` |
| 119 | elif [ "$defaultKeyID" = "1" ];then |
| 120 | wifi_password=`nv get Key2Str1_5g` |
| 121 | elif [ "$defaultKeyID" = "2" ];then |
| 122 | wifi_password=`nv get Key3Str1_5g` |
| 123 | elif [ "$defaultKeyID" = "3" ];then |
| 124 | wifi_password=`nv get Key4Str1_5g` |
| 125 | else |
| 126 | wifi_password=`nv get Key1Str1_5g` |
| 127 | fi |
| 128 | qrcode_text='WIFI:T:WEP;S:'$wifi_ssid_name';P:'$wifi_password';' |
| 129 | echo "qrcode_text = $qrcode_text" |
| 130 | elif [ "$wifi_encry_type" = "NONE" ];then |
| 131 | qrcode_text='WIFI:S:'$wifi_ssid_name';' |
| 132 | echo "qrcode_text = $qrcode_text" |
| 133 | fi |
| 134 | |
| 135 | qrencode -o $wifi_5g_ssid_qrcode_name -m 10 -s 2 "$qrcode_text" |
| 136 | png2bmp -O $wifi_5g_ssid_qrcode_name_bmp $wifi_5g_ssid_qrcode_name |
| 137 | |
| 138 | cp $wifi_5g_ssid_qrcode_name $target_web_dir |
| 139 | cp $wifi_5g_ssid_qrcode_name $target_vue_web_dir |
| 140 | |
| 141 | ;; |
| 142 | |
| 143 | "multi_wifi_create") |
| 144 | echo "enter the multi_wifi_create function" |
| 145 | |
| 146 | rm -rf $multi_wifi_ssid_qrcode_name_bmp |
| 147 | rm -rf $multi_wifi_ssid_qrcode_name |
| 148 | |
| 149 | #multi_wifi_ssid_name=`zte_nvc_apps read m_SSID` # multi wifi ssid |
| 150 | #multi_wifi_auth_mode=`zte_nvc_apps read m_AuthMode` #multi wifi auth mode |
| 151 | #multi_wifi_encry_type=`zte_nvc_apps read m_EncrypType` #multi wifi encry type |
| 152 | #multi_wifi_password=`zte_nvc_apps read m_WPAPSK1` #multi wifi password |
| 153 | multi_wifi_ssid_name=`nv get m_SSID` # wifi ssid |
| 154 | multi_wifi_auth_mode=`nv get m_AuthMode` # wifi auth mode |
| 155 | multi_wifi_encry_type=`nv get m_EncrypType` # wifi encry type |
| 156 | multi_wifi_password=`nv get m_WPAPSK1` # wifi password |
| 157 | auth_wpa=`echo $multi_wifi_auth_mode | sed -n '/WPA/p'` |
| 158 | auth_wpa_1=`echo $multi_wifi_auth_mode | sed -n '/WPA3/p'` |
| 159 | if [ -n "$auth_wpa" ];then # wpa |
| 160 | if [ -n "$auth_wpa_1" ];then |
| 161 | wifi_T="SAE" |
| 162 | else |
| 163 | wifi_T="WPA" |
| 164 | fi |
| 165 | qrcode_text='WIFI:T:'$wifi_T';S:'$multi_wifi_ssid_name';P:'$multi_wifi_password';' |
| 166 | echo "qrcode_text = $qrcode_text" |
| 167 | ##elif [ "$multi_wifi_encry_type" = "WEP" ];then |
| 168 | elif [ "$multi_wifi_encry_type" = "WEP" -o "$multi_wifi_auth_mode" = "SHARED" -o "$multi_wifi_auth_mode" = "WEPAUTO" ];then |
| 169 | multi_defaultKeyID=`nv get m_DefaultKeyID` |
| 170 | if [ "$multi_defaultKeyID" = "0" ];then |
| 171 | multi_wifi_password=`nv get m_Key1Str1` |
| 172 | elif [ "$multi_defaultKeyID" = "1" ];then |
| 173 | multi_wifi_password=`nv get m_Key2Str1` |
| 174 | elif [ "$multi_defaultKeyID" = "2" ];then |
| 175 | multi_wifi_password=`nv get m_Key3Str1` |
| 176 | elif [ "$multi_defaultKeyID" = "3" ];then |
| 177 | multi_wifi_password=`nv get m_Key4Str1` |
| 178 | else |
| 179 | multi_wifi_password=`nv get m_Key1Str1` |
| 180 | fi |
| 181 | qrcode_text='WIFI:T:WEP;S:'$multi_wifi_ssid_name';P:'$multi_wifi_password';' |
| 182 | echo "qrcode_text = $qrcode_text" |
| 183 | elif [ "$multi_wifi_encry_type" = "NONE" ];then |
| 184 | qrcode_text='WIFI:S:'$multi_wifi_ssid_name';' |
| 185 | echo "qrcode_text = $qrcode_text" |
| 186 | fi |
| 187 | |
| 188 | qrencode -o $multi_wifi_ssid_qrcode_name -m 10 -s 2 "$qrcode_text" |
| 189 | png2bmp -O $multi_wifi_ssid_qrcode_name_bmp $multi_wifi_ssid_qrcode_name |
| 190 | |
| 191 | cp $multi_wifi_ssid_qrcode_name $target_web_dir |
| 192 | cp $multi_wifi_ssid_qrcode_name $target_vue_web_dir |
| 193 | ;; |
| 194 | |
| 195 | "local_domain_create") |
| 196 | echo "enter the local_url_create function" |
| 197 | |
| 198 | rm -rf $local_domain_qrcode_name_bmp |
| 199 | |
| 200 | local_domain_url=`zte_nvc_apps read LocalDomain` #local domain name |
| 201 | local_domain_username=`zte_nvc_apps read admin_user` #local domain username |
| 202 | local_domain_passwd=`zte_nvc_apps read admin_Password` #local domain password |
| 203 | |
| 204 | qrcode_text='http://'$local_domain_url |
| 205 | echo "qrcode_text = $qrcode_text" |
| 206 | |
| 207 | qrencode -o $local_domain_qrcode_name -m 10 -s 2 "$qrcode_text" |
| 208 | png2bmp -O $local_domain_qrcode_name_bmp $local_domain_qrcode_name |
| 209 | |
| 210 | local_domain_qrcode_name |
| 211 | |
| 212 | ;; |
| 213 | esac |