There's no useful answer for this on the internet, so the lion kingdom finally wrote a python script to do the job. The mane reason for doing it is when the systemd scripts don't work.
#!/usr/bin/python
# start up wpa_supplicant, wait for a connection, then start up dhclient
import os
import sys
import subprocess
p = subprocess.Popen(['wpa_supplicant',
'-iwlan0',
'-c/etc/wpa_supplicant/wpa_supplicant.conf'],
stdout=subprocess.PIPE)
while True:
line = p.stdout.readline()
print 'Got: ', line
if "CTRL-EVENT-CONNECTED" in line:
# start DHCP
subprocess.call(['dhclient', '-v', 'wlan0'])
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.