Closed HokieGeek closed 9 years ago
Store a file with the following format:
priority,ssid,security,key
Step The First: Write code that just reads this file and performs a connection Step The Second: Write code that can update the file
This is related to https://github.com/HokieGeek/dotfiles/issues/51
Ok, hold your horses... You are reinventing the wheel, I think. First, let's figure out why netctl and wifi-menu weren't enough to get the job done.
Also, the entire script is dumb anyway. So, if we assume that netctl and wifi-menu -o will work, then maybe this should be refactored differently:
#!/bin/bash
if [ `pacman -Q1 netctl` -eq 1 ]; then
echo "=====> Installing networking tools"
pacman -S --needed netctl iw wpa_supplicant wpa_actiond dialog ifplugd
fi
wired=`iw dev | awk '$0 ~ /Interface/ { print $2 }' | egrep '^en'` # FIXME: UNTESTED!
if [ ! -z "${wired}" ]; then
echo "=====> Setting up ethernet connection"
# TODO: cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/default
# TODO: edit that file to be correct
systemctl enable netctl-ifplugd@${wired}.service
systemctl start netctl-ifplugd@${wired}.service
fi
wireless=`iw dev | awk '$0 ~ /Interface/ { print $2 }' | egrep '^w` # FIXME: UNTESTED!
if [ ! -z "${wireless}" ]; then
echo "=====> Setting up wireless connection"
ip link set dev ${wireless} up
wifi-menu -o
systemctl enable netctl-auto@${wireless}.service
systemctl start netctl-auto@${wireless}.service
fi
ping -c 3 www.google.com
exit $?
For reference: https://wiki.archlinux.org/index.php/netctl
if [ `pacman -Q1 netctl` -eq 1 -o `pacman -Q1 iw` -eq 1 ]; then
The current script really gets the job done so I'm closing this
https://wiki.archlinux.org/index.php/Wireless_network_configuration#Manual_setup