diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-11-17 19:04:38 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-11-17 19:04:38 +0100 |
commit | 521a0b336c7df8ad79efc7848c95a7b060beea27 (patch) | |
tree | c3fd7364aac44a308922108b68e82672bb8d1d4b /sys/src/9/boot | |
parent | b31e965ea36f21cf4da91ae33d840999e10a76d4 (diff) |
bootrc: for wireless netbooting, set the WPA/WPA2 preshard key with wpapsk=password boot parameter
this allows automatic netbooting without password prompt
for the wirelss network.
Diffstat (limited to 'sys/src/9/boot')
-rwxr-xr-x | sys/src/9/boot/net.rc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/sys/src/9/boot/net.rc b/sys/src/9/boot/net.rc index 1a194dd84..54d108eed 100755 --- a/sys/src/9/boot/net.rc +++ b/sys/src/9/boot/net.rc @@ -9,10 +9,23 @@ fn confignet{ } # setup wifi encryption if any - if(~ $1 ether && ~ $service terminal && test -x /bin/aux/wpa){ - if(grep -s '^status: need authentication' $2/ifstats >[2]/dev/null){ - aux/wpa -p $2 + if(~ $1 ether && test -x /bin/aux/wpa){ + essid=`{grep '^essid: ' $2/ifstats | sed 's/^essid: //; q'} + if(! ~ $#essid 0){ + if(! ~ $#wpapsk 0 || grep -s '^status: need authentication' $2/ifstats >[2]/dev/null){ + x=(aux/wpa -s $"essid) + if(! ~ $#wpapsk 0){ + echo 'key proto=wpapsk' `{!password=$"wpapsk whatis essid !password} > /mnt/factotum/ctl + wpapsk=() + } + if not { + x=($x -p) + } + $x $2 + } + essid=() } + rm -f /env/^(essid wpapsk) } if(~ $1 ether gbe && ~ $#* 2) @{ |