forgot to add wifi settings
This commit is contained in:
parent
3a2eca4b98
commit
3e33abe0a6
5
aif.xsd
5
aif.xsd
@ -244,7 +244,7 @@
|
|||||||
<xs:restriction base="xs:token">
|
<xs:restriction base="xs:token">
|
||||||
<xs:enumeration value="netctl"/>
|
<xs:enumeration value="netctl"/>
|
||||||
<xs:enumeration value="nm"/>
|
<xs:enumeration value="nm"/>
|
||||||
<xs:enumeration value="systemd"/>
|
<xs:enumeration value="networkd"/>
|
||||||
<xs:whiteSpace value="collapse"/>
|
<xs:whiteSpace value="collapse"/>
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
@ -465,6 +465,7 @@
|
|||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
<xs:attribute name="essid" type="xs:string" use="required"/>
|
<xs:attribute name="essid" type="xs:string" use="required"/>
|
||||||
<xs:attribute name="bssid" type="aif:t_mac_addr" use="optional"/>
|
<xs:attribute name="bssid" type="aif:t_mac_addr" use="optional"/>
|
||||||
|
<xs:attribute name="hidden" type="xs:boolean" use="optional" default="false"/>
|
||||||
</xs:extension>
|
</xs:extension>
|
||||||
</xs:complexContent>
|
</xs:complexContent>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
@ -887,7 +888,7 @@
|
|||||||
</xs:choice>
|
</xs:choice>
|
||||||
<!-- It's nearly impossible to validate FQDNs/hostnames in XSD, so we do it in-code. -->
|
<!-- It's nearly impossible to validate FQDNs/hostnames in XSD, so we do it in-code. -->
|
||||||
<xs:attribute name="hostname" type="aif:t_nonempty" use="required"/>
|
<xs:attribute name="hostname" type="aif:t_nonempty" use="required"/>
|
||||||
<xs:attribute name="provider" type="aif:t_netprov" use="optional" default="systemd"/>
|
<xs:attribute name="provider" type="aif:t_netprov" use="optional" default="networkd"/>
|
||||||
<xs:attribute name="dhcpClient" type="aif:t_dhcp_clients" use="optional" default="dhcpcd"/>
|
<xs:attribute name="dhcpClient" type="aif:t_dhcp_clients" use="optional" default="dhcpcd"/>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
<xs:unique name="uniq_iface_eth">
|
<xs:unique name="uniq_iface_eth">
|
||||||
|
@ -5,13 +5,13 @@ class Network(object):
|
|||||||
def __init__(self, network_xml):
|
def __init__(self, network_xml):
|
||||||
self.xml = network_xml
|
self.xml = network_xml
|
||||||
self.hostname = self.xml.attrib['hostname'].strip()
|
self.hostname = self.xml.attrib['hostname'].strip()
|
||||||
self.provider = self.xml.attrib.get('provider', 'systemd').strip()
|
self.provider = self.xml.attrib.get('provider', 'networkd').strip()
|
||||||
handler = None
|
handler = None
|
||||||
if self.provider == 'netctl':
|
if self.provider == 'netctl':
|
||||||
import aif.network.netctl as handler
|
import aif.network.netctl as handler
|
||||||
elif self.provider == 'nm':
|
elif self.provider == 'nm':
|
||||||
import aif.network.networkmanager as handler
|
import aif.network.networkmanager as handler
|
||||||
elif self.provider == 'systemd':
|
elif self.provider == 'networkd':
|
||||||
import aif.network.networkd as handler
|
import aif.network.networkd as handler
|
||||||
self.provider = handler
|
self.provider = handler
|
||||||
if not self.provider:
|
if not self.provider:
|
||||||
|
@ -275,3 +275,29 @@ class Wireless(Connection):
|
|||||||
super().__init__(iface_xml)
|
super().__init__(iface_xml)
|
||||||
self.connection_type = 'wireless'
|
self.connection_type = 'wireless'
|
||||||
self._initCfg()
|
self._initCfg()
|
||||||
|
self._initConnCfg()
|
||||||
|
|
||||||
|
def _initConnCfg(self):
|
||||||
|
self._cfg['BASE']['ESSID'] = "'{0}'".format(self.xml.attrib['essid'])
|
||||||
|
hidden = aif.utils.xmlBool(self.xml.attrib.get('hidden', 'false'))
|
||||||
|
if hidden:
|
||||||
|
self._cfg['BASE']['Hidden'] = 'yes'
|
||||||
|
try:
|
||||||
|
bssid = self.xml.attrib.get('bssid').strip()
|
||||||
|
except AttributeError:
|
||||||
|
bssid = None
|
||||||
|
if bssid:
|
||||||
|
bssid = aif.network._common.canonizeEUI(bssid)
|
||||||
|
self._cfg['BASE']['AP'] = bssid
|
||||||
|
crypto = self.xml.find('encryption')
|
||||||
|
if crypto:
|
||||||
|
self.packages.add('wpa_supplicant')
|
||||||
|
crypto = aif.network._common.convertWifiCrypto(crypto)
|
||||||
|
# if crypto['type'] in ('wpa', 'wpa2', 'wpa3'):
|
||||||
|
if crypto['type'] in ('wpa', 'wpa2'):
|
||||||
|
# TODO: WPA2 enterprise
|
||||||
|
self._cfg['BASE']['Security'] = 'wpa'
|
||||||
|
# if crypto['type'] in ('wep', 'wpa', 'wpa2', 'wpa3'):
|
||||||
|
if crypto['type'] in ('wpa', 'wpa2'):
|
||||||
|
self._cfg['BASE']['Key'] = crypto['auth']['psk']
|
||||||
|
return()
|
||||||
|
@ -5,3 +5,4 @@ import socket
|
|||||||
# (https://stackoverflow.com/a/38286559/733214), there's no way to *write* an INI with them using configparser.
|
# (https://stackoverflow.com/a/38286559/733214), there's no way to *write* an INI with them using configparser.
|
||||||
# So we use Jinja2 logic.
|
# So we use Jinja2 logic.
|
||||||
import jinja2
|
import jinja2
|
||||||
|
|
||||||
|
@ -589,7 +589,7 @@ This is going to be highly unpredictable based on the networking provider you ch
|
|||||||
=== "I'm using netctl as my network provider, and-"
|
=== "I'm using netctl as my network provider, and-"
|
||||||
I'ma let you finish, but netctl is a *really* simple network provider. I mean REALLY simple. As such, a lot of things (like mixing auto DNS and non-auto addressing) don't work at all feasibly, and probably might not ever. It's great for simple and flat configurations (i.e. all static everything, all automatic everything, etc.) and I even use it on my own machines where I can, but it just simply doesn't make allowances for more complex setups. (This is why init scripts were replaced by systemd for init, remember? Script-and-shell-based utilities, such as netctl -- seriously, the entire thing's written in Bash -- just can't handle more complex jobs reliably.)
|
I'ma let you finish, but netctl is a *really* simple network provider. I mean REALLY simple. As such, a lot of things (like mixing auto DNS and non-auto addressing) don't work at all feasibly, and probably might not ever. It's great for simple and flat configurations (i.e. all static everything, all automatic everything, etc.) and I even use it on my own machines where I can, but it just simply doesn't make allowances for more complex setups. (This is why init scripts were replaced by systemd for init, remember? Script-and-shell-based utilities, such as netctl -- seriously, the entire thing's written in Bash -- just can't handle more complex jobs reliably.)
|
||||||
|
|
||||||
If you need more advanced functionality but don't want a lot of cruft or bloat, I recommend `systemd` as your network provider. It requires no extra packages (other than wpa_supplicant, if you're using wireless) because it's part of the systemd package (which is part of the most basic install of Arch) and handles more advanced configurations a lot more reliably.
|
If you need more advanced functionality but don't want a lot of cruft or bloat, I recommend `networkd` as your network provider. It requires no extra packages (other than wpa_supplicant, if you're using wireless) because it's part of the systemd package (which is part of the most basic install of Arch) and handles more advanced configurations a lot more reliably.
|
||||||
|
|
||||||
=== "How do I specify WEP for a wireless network?"
|
=== "How do I specify WEP for a wireless network?"
|
||||||
You can't. WEP's pretty broken. I understand some legacy networks may still use it, but I'm incredibly uncomfortable supporting it.
|
You can't. WEP's pretty broken. I understand some legacy networks may still use it, but I'm incredibly uncomfortable supporting it.
|
||||||
|
Loading…
Reference in New Issue
Block a user