HokieGeek / distro-config

Used to configure or build a linux distribution
0 stars 0 forks source link

Finish refactor of wifi config #12

Closed HokieGeek closed 9 years ago

HokieGeek commented 10 years ago

https://wiki.archlinux.org/index.php/Wireless_network_configuration#Manual_setup

HokieGeek commented 10 years ago

Store a file with the following format:

priority,ssid,security,key
HokieGeek commented 10 years ago

Step The First: Write code that just reads this file and performs a connection Step The Second: Write code that can update the file

HokieGeek commented 10 years ago

This is related to https://github.com/HokieGeek/dotfiles/issues/51

HokieGeek commented 10 years ago
  1. Build file with connection information
  2. Create the automatic stuff
  3. Connect
HokieGeek commented 10 years ago

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 $?
HokieGeek commented 10 years ago

For reference: https://wiki.archlinux.org/index.php/netctl

HokieGeek commented 10 years ago
if [ `pacman -Q1 netctl` -eq 1 -o `pacman -Q1 iw` -eq 1 ]; then
HokieGeek commented 9 years ago

The current script really gets the job done so I'm closing this