fossasia / susi_linux

Hardware for SUSI AI https://susi.ai
Apache License 2.0
1.6k stars 148 forks source link

iface simplification #475

Closed norbusan closed 5 years ago

norbusan commented 5 years ago

Hi all,

I propose the following change to interface handling.

Current status

when booting the first time, the unit is in hostap mode with an entry for wlan0 in /etc/network/interfaces. This triggers a failure in the dhcpcd server startup, since it rejects starting when there are interfaces configured with dhcp or fixed ip in the interfaces file.

The wap.sh and rwap.sh do complicated sed command to replace lines in the interface script and restore previous states.

Furthermore, currently the eth0 interface is not acticated by default, which is also a cosequence of the dhcpcd daemon not starting.

New solution

Debian/stretch, the basis of Raspian and thus SUSIbian, support /etc/network/interfaces.d/ and reads all files there, but only those where the filename matches alphanumeric. We provide three files there: eth0, wlan.hostap, wlan.client. The first one defines the eth0 interface as dhcp based, which makes it available automatically. The other two are disabled by default (not matching alphanumeric due to the dot).

The wap.sh and rwap.sh only copies their respective files to wlan-hostap and wlan-client, respectively, and removes the other one, thus activating the wlan device either in hostap (access point mode) or in client mode (wpa supplicant).

Tests

The change have been tested on pi-gen generated images.