I had (and still have, but that a different issue) a problem with a video driver (nouveau) crashing the x-server on the Fedora 12 alpha release, so I needed to connect my laptop to the Internet via my wireless connection without using a window manager.
Fedora 12 includes the
cnetworkmanager package for access the NetworkManager functionality from the command line, but that package does not exit after the connection is made. Of course, you can do a Ctrl-Alt-F3 to open a new terminal window, but that seemed to me to be somewhat inelegant. So I wrote a simple script to which I could pass an access point name and a WPA2 pass-phrase that would do the job for me. Since it worked well, I thought others might find it useful. So, here it is:
Code:
#!/bin/bash
[ $# -eq 0 ] && echo Usage $0 AP [pass_phrase] && exit 1
pass=$2
[ -z "$pass" ] && pass=.....
cnetworkmanager -C $1 --wpa-pass $pass &
disown
Note 1: Tthe default pass-phrase is redacted, and the script is in
/root so it's somewhat protected.
Note 2:
cnetworkmanager --help describes alternatives to WPA encryption. The script is, obviously, specific to my needs.
Note 3: I don't know if the
cnetworkmanager package is generally available, but, if it is, it's a nice tool to have available. (Although the curses interface to
wicd is, actually, much easier to use. Unfortunately,
wicd isn't in the Fedora
rawhide repository, so
NetworkManager is the only way to go unless you're a masochist who like to manage your connections by hand.)