Skip to content

Commit

Permalink
Allow configuring multiple wifi networks using wpa_supplicant (#250)
Browse files Browse the repository at this point in the history
* use wpa_supplicant to configure wifi

* filename change octopi-network.txt -> octopi-ethernet.txt since it only configures ethernet now

* better format

* revert 22ec5ac 13e3fc1 ff3f351

* Only add /boot/octopi-wifi.txt, symlinked to /etc/wpa_supplicant/wpa_supplicant.conf, without breaking existing /boot/octopi-network.txt mechanism

* clear documentation for distinctions between octopi-network.txt and octopi-wifi.txt

* Change name /boot/octopi-wifi.txt -> /boot/octopi-wpa-supplicant.txt to avoid confusion
  • Loading branch information
kennethjiang authored and foosel committed Aug 15, 2016
1 parent 1954b8d commit 326bbdf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,26 @@ echo "mapping wlan1" >> /etc/network/interfaces
echo " script /root/bin/map_iface" >> /etc/network/interfaces
echo "source /boot/octopi-network.txt" >> /etc/network/interfaces

# allow configuring multiple wifi networks via /boot/octopi-wpa-supplicant.txt
mv /etc/wpa_supplicant/wpa_supplicant.conf /boot/octopi-wpa-supplicant.txt
ln -s /boot/octopi-wpa-supplicant.txt /etc/wpa_supplicant/wpa_supplicant.conf
cat <<EOT >> /etc/wpa_supplicant/wpa_supplicant.conf
# This is only used to configure multiple wifi networks or other advanced wifi features.
# take a look into octopi-network.txt instead if you only need basic wifi configuration
# 'man -s 5 wpa_supplicant.conf' for advanced options
#network={
# ssid="Your Wifi SSID"
# psk="supersecretwifipassword"
#}
## You can configure more than 1 wifi networks by adding more 'network' blocks
#network={
# ssid="Another Wifi"
# psk="password"
#}
EOT

# copy /etc/wpa_supplicant/ifupdown.sh to /etc/ifplugd/action.d/ifupdown - for wlan auto reconnect
[ -f /etc/ifplugd/action.d/ifupdown ] && mv /etc/ifplugd/action.d/ifupdown /etc/ifplugd/action.d/ifupdown.original
[ -f /etc/wpa_supplicant/ifupdown.sh ] && ln -s /etc/wpa_supplicant/ifupdown.sh /etc/ifplugd/action.d/ifupdown
Expand Down
2 changes: 2 additions & 0 deletions src/filesystem/boot/octopi-network.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#
# Just uncomment the lines prefixed with a single # of the configuration
# that matches your wifi setup and fill in SSID and passphrase.
#
# If you need to configure more than 1 wifi networks, please use /boot/octopi-wpa-supplicant.txt instead

## WPA/WPA2 secured
#iface wlan0-octopi inet manual
Expand Down

0 comments on commit 326bbdf

Please sign in to comment.