* imported qemu/hotfix-glibc-2.41.patch
[t2sde.git] / package / network / wpa_supplicant / rocknet_wpa.sh
blobfe4ee69f5bdb5a7d24ac1b190250b3f876fc65de
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/wpa_supplicant/rocknet_wpa.sh
3 # Copyright (C) 2004 - 2024 The T2 SDE Project
4 #
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License version 2.
10 # --- T2-COPYRIGHT-NOTE-END ---
12 wpa_write_conf() {
13 local if=$1
14 local ssid=${wpa_ssid[$if]}
15 local psk=${wpa_psk[$if]}
16 # add quotes if necessary
17 [[ "$ssid" != \"*\" ]] && ssid="\"$ssid\""
18 [[ "$psk" != \"*\" ]] && psk="\"$psk\""
20 cat > /var/run/wpa_supplicant-$if.conf <<EOT
21 ctrl_interface=/var/run/wpa_supplicant
22 network={
23 ssid=$ssid
24 psk=$psk
26 EOT
29 wpa_init_if() {
30 if isfirst "wpa_$if"; then
31 addcode up 5 2 "wpa_write_conf $if"
32 addcode up 5 3 "wpa_supplicant -Dnl80211,wext -i$if -B \
33 -c/var/run/wpa_supplicant-$if.conf -P/var/run/wpa_supplicant-$if.pid"
34 addcode down 5 2 "rm -f /var/run/wpa_supplicant-$if.{pid,conf}"
35 addcode down 5 3 "kill \$(cat /var/run/wpa_supplicant-$if.pid)"
39 public_ssid() {
40 wpa_init_if
41 wpa_ssid[$if]="$*"
44 public_psk() {
45 wpa_init_if
46 wpa_psk[$if]="$*"