Getting started with an OpenBSD Desktop...

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting started with an OpenBSD Desktop...

Implausibility
Hi.

I have a few old ThinkPads here, and I'd like to explore getting OpenBSD
running as a lightweight desktop computer.

I don't need a lot, I spend most of my time at a shell prompt, but I'm
thinking I need a better window manager, possibly Firefox (or a recommended
lightweight alternative) and any invaluable X-based utilities.

I've had trouble getting the laptop connected to my local WiFi network,
despite having compatible cards and a straightforward security config (WPA2),
despite having followed the documentation.  If there's a
network-connection-manager GUI available, that would be nice, but isn't
essential.

I know how to install things via the ports, but traversing the directory
structure to find useful packages is painful.  If there's a more friendly way
to search for and discover new/interesting ports packages, I'd appreciate a
link.

Thanks.

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

Michael McConville-3
Implausibility wrote:
> I know how to install things via the ports, but traversing the
> directory structure to find useful packages is painful.  If there's a
> more friendly way to search for and discover new/interesting ports
> packages, I'd appreciate a link.

'pkg_info -Q $YOUR_QUERY' will show package names containing
$YOUR_QUERY.

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

fwsoucy
In reply to this post by Implausibility
On 2016.04.12, Implausibility wrote:
> Hi.
>
> I have a few old ThinkPads here, and I'd like to explore getting OpenBSD
> running as a lightweight desktop computer.
>
> I don't need a lot, I spend most of my time at a shell prompt, but I'm
> thinking I need a better window manager, possibly Firefox (or a recommended
> lightweight alternative) and any invaluable X-based utilities.
>
OpenBSD comes with the excellent window manager cwm installed by
default. It has top-notch keyboard control, the ability to organize
windows into groups and dynamically display them and search for windows
by name to list some of it`s highlights. Also it isn`t an obnoxious
tiling monstrosity that seem all the rage these days.

> I've had trouble getting the laptop connected to my local WiFi network,
> despite having compatible cards and a straightforward security config (WPA2),

Wifi is pretty straight forward in OpenBSD. Either from the cli:
# ifconfig <interface> up nwid <network> wpakey <password>
# dhclient <interface>
check man hostname.if for a permenant setup.

It could be that your wifi card needs firmware that isn`t installed.
If you can connect via ethernet try to run fw_update.

> despite having followed the documentation.  If there's a
> network-connection-manager GUI available, that would be nice, but isn't
> essential.
>
> I know how to install things via the ports, but traversing the directory
> structure to find useful packages is painful.  If there's a more friendly way
> to search for and discover new/interesting ports packages, I'd appreciate a
> link.

As was said pkg_info -Q <string> will perform a search for you.
There are some websites where you can browse the ports tree in
catagory form. Keep in mind though that they are showing the ports for
-current and some may not be available in -release.
http://ports.su
http://openports.se

>
> Thanks.

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

Chris Bennett
In reply to this post by Implausibility
On Tue, Apr 12, 2016 at 08:34:16PM -0400, Implausibility wrote:
> Hi.
>
> I have a few old ThinkPads here, and I'd like to explore getting OpenBSD
> running as a lightweight desktop computer.
>
> I don't need a lot, I spend most of my time at a shell prompt, but I'm
> thinking I need a better window manager, possibly Firefox (or a recommended
> lightweight alternative) and any invaluable X-based utilities.

I'm biased in that I use older computers. I find that using spectrwm as
a window manager and terminus fonts to be an excellent and extremely low
memory and CPU time. It defaults to 10 screens and can be extended to 22
(right?)Within each screen you can have multiple windows and "float"
them into nice positions, just like managers like KDE do.

I started off with KDE, coming from the windows world, but quickly tired
of it and jumped over to spectrwm once it was developed.

Ports contains a few programs that are NOT in packages and also some
FLAVORS that you might prefer over the standard packages. But always use
the packages unless you have some special needs. I find looking around
the ports tree very helpful to find out possible programs I need.
Then I just type pkg_add program_i_need program_to_try, etc.

I install lynx text browser and use lynx $PKG_PATH to look for relevant
but not obvious choices. I speak Spanish also which makes finding
Spanish language files for different programs a breeze doing that.
But lynx works poorly outside of a window manager xterm. I open another
xterm next to it and pkg_add away everything I see that might be good.

Maybe bad advice, but I use ifconfig xxx0 down, pull the card out, then
back in and try again. ifconfig xxx0 scan is very helpful!

And of course, asking for exactly what you need (in subject!) might get
you good advice. Or maybe not. Behind the scenes, the developers are
working their arses off making things better, so don't be offended if
you don't get an answer.

Good luck

Chris Bennett

>
> I've had trouble getting the laptop connected to my local WiFi network,
> despite having compatible cards and a straightforward security config (WPA2),
> despite having followed the documentation.  If there's a
> network-connection-manager GUI available, that would be nice, but isn't
> essential.
>
> I know how to install things via the ports, but traversing the directory
> structure to find useful packages is painful.  If there's a more friendly way
> to search for and discover new/interesting ports packages, I'd appreciate a
> link.
>
> Thanks.

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

Chris Bennett
In reply to this post by fwsoucy
On Tue, Apr 12, 2016 at 08:24:15PM -0500, frederick w. soucy wrote:
> It could be that your wifi card needs firmware that isn`t installed.
> If you can connect via ethernet try to run fw_update.

You may need to use wired network to get the firmware.
When I install onto a usb flash drive, I use fw_update -a to make sure I
have firmware for anything I might run into.
That command installs everything! But it will also cover your new wifi
card after the present one cooks itself dead later!

But all the firmware really isn't that big a group. It's up to you.

Chris Bennett

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

lists-2
In reply to this post by Michael McConville-3
Tue, 12 Apr 2016 20:40:52 -0400 Michael McConville <[hidden email]>
> Implausibility wrote:
> > I know how to install things via the ports, but traversing the
> > directory structure to find useful packages is painful.  If there's a
> > more friendly way to search for and discover new/interesting ports
> > packages, I'd appreciate a link.  
>
> 'pkg_info -Q $YOUR_QUERY' will show package names containing
> $YOUR_QUERY.

This provides description for a specific package:

$ pkg_info -d pkg_mgr

Description:
pkg_mgr is a high-level, user-friendly package browser for OpenBSD..

This installs a package:

$ pkg_add -vvvvv pkg_mgr

The cvsweb has a category sysutils for more ports like pkg_mgr:

[http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/sysutils/]

You use the pkg_mgr to quickly browse, pkg_add to install, and cvsweb
to read ports details should you need these.

For some additional web based convenience you can at times query the
external page:

[http://openports.se/sysutils]

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

Erling Westenvik-2
In reply to this post by Implausibility
On Tue, Apr 12, 2016 at 08:34:16PM -0400, Implausibility wrote:

> Hi.
>
> I have a few old ThinkPads here, and I'd like to explore getting OpenBSD
> running as a lightweight desktop computer.
>
> I don't need a lot, I spend most of my time at a shell prompt, but I'm
> thinking I need a better window manager, possibly Firefox (or a recommended
> lightweight alternative) and any invaluable X-based utilities.
>
> I've had trouble getting the laptop connected to my local WiFi network,
> despite having compatible cards and a straightforward security config (WPA2),
> despite having followed the documentation.  If there's a
> network-connection-manager GUI available, that would be nice, but isn't
> essential.

Various attempts on creating "generic" wifi network connection manager
scripts have been made. None with a true GUI AFAIK. I used the shell script from
github below for some time on my T500 but lately it hasn't worked as
expected and I haven't had the time to investigate. (Currently I just
have half a dozen shell scripts, one for each wifi network I'm
connecting to.)

https://github.com/devious/wiconfig

>
> I know how to install things via the ports, but traversing the directory
> structure to find useful packages is painful.  If there's a more friendly way
> to search for and discover new/interesting ports packages, I'd appreciate a
> link.

There is pkg_mgr(1) in packages. I use it a lot to poke around looking
for interesting packages. Have a look at its description by issuing:

$ pkg_info pkg_mgr

and install it with:

# pkg_add pkg_mgr


When looking for ports I use:

$ cd /usr/ports
$ make search key=<keyword>


> Thanks.

Regards,

Erling

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

Craig Skinner-3
In reply to this post by Implausibility
Hi there,

On 2016-04-12 Tue 20:34 PM |, Implausibility wrote:
>
> I don't need a lot, I spend most of my time at a shell prompt, but I'm
> thinking I need a better window manager, possibly Firefox (or a recommended
> lightweight alternative) and any invaluable X-based utilities.
>

dillo is a useful lightweight non-java-script GUI web browser,
great for simple sites, web searches, etc.

claws-mail is a pretty good GUI mail client.

Cool.
--
"I cannot and will not cut my conscience to fit this year's fashions."
                -- Lillian Hellman

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

Mike Burns
In reply to this post by Erling Westenvik-2
On 2016-04-13 10.42.28 +0200, Erling Westenvik wrote:
> On Tue, Apr 12, 2016 at 08:34:16PM -0400, Implausibility wrote:
> Various attempts on creating "generic" wifi network connection manager
> scripts have been made. None with a true GUI AFAIK.

I hooked some shell scripts up with zenity to make a GUI.

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

Implausibility
Thanks to everyone for their comments!

I'm going to put a fresh install of OpenBSD 5.9 on my laptop, and I'll try all
of your recommendations.

Take care.

> On Apr 13, 2016, at 5:37 AM, Mike Burns <[hidden email]>
wrote:
>
> On 2016-04-13 10.42.28 +0200, Erling Westenvik wrote:
>> On Tue, Apr 12, 2016 at 08:34:16PM -0400, Implausibility wrote:
>> Various attempts on creating "generic" wifi network connection manager
>> scripts have been made. None with a true GUI AFAIK.
>
> I hooked some shell scripts up with zenity to make a GUI.

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

Erling Westenvik-2
In reply to this post by Mike Burns
On Wed, Apr 13, 2016 at 09:37:53AM +0000, Mike Burns wrote:
> On 2016-04-13 10.42.28 +0200, Erling Westenvik wrote:
> > On Tue, Apr 12, 2016 at 08:34:16PM -0400, Implausibility wrote:
> > Various attempts on creating "generic" wifi network connection manager
> > scripts have been made. None with a true GUI AFAIK.
>
> I hooked some shell scripts up with zenity to make a GUI.
>
Interesting. Care to share the code somewhere? Maybe it could evolve
into a port/package?

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

Mihai Popescu-3
In reply to this post by Implausibility
> Maybe it could evolve into a port/package?

So, what is the benefit of typing a text in a text box GUI rather than
a terminal?
Again, what is the benefit of displaying a list of wifi networks with
funny beam sign (which tell you nothing, bytheway) rather that read a
dBm result from scan option in terminal?

That so called GUI will bring you nothing different from a general
confusion. WiFi connect is an utility not a graphical application.

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

Mike Burns
In reply to this post by Erling Westenvik-2
On 2016-04-13 15.31.36 +0200, Erling Westenvik wrote:
> On Wed, Apr 13, 2016 at 09:37:53AM +0000, Mike Burns wrote:
> > I hooked some shell scripts up with zenity to make a wifi GUI.
> >
> Interesting. Care to share the code somewhere? Maybe it could evolve
> into a port/package?

I'll share the code, but it has some caveats:

- I made this for my laptop and my use cases.
- I hate automation.
- It's not very good.
- The GUI gives no feedback after you select the access point.

Feel free to turn it into anything you'd like.

Attached is a man page for wifi(1), the wifi script itself, and wifi-gtk
which makes use of the wifi script. Run it as 'doas wifi-gtk -C $HOME/.wifi',
where $HOME/.wifi is your wifi config (see the attached man page).

===
wifi.1:
===

.Dd $Mdocdate$
.Dt WIFI 1
.Os
.Sh WIFI
.Nm wifi
.Nd connect to OpenBSD wifi
.Sh SYNOPSIS
.Nm progname
.Fl C Ar config
.Fl i Ar iface
.Ar nickname
.Sh DESCRIPTION
The
.Nm
utility connects to the wifi on the interface
.Ar iface
according to the
.Ar nickname
as read from
.Ar config .
.\" .Sh ENVIRONMENT
.\" For sections 1, 6, 7, and 8 only.
.Sh FILES
The configuration file follows a simple format:
.Pp
.Dl nickname: ifconfig-options autoconfiguration
.Pp
These three values are as follow:
.Bl -tag -width Ds
.It Va nickname
The name of the wifi network, to be passed to the
.Nm
program.
.It Va ifconfig-options
Options for
.Xr ifconfig 1 ,
such as
.Li nwid
and
.Li wpakey .
.It Va autoconfiguration
Either
.Li dhcp
for DHCP or
.Li rtsol
for IPv6 autoconf.
.El
.Sh EXIT STATUS
The exit status of
.Nm
is the same as the exit status of the
.Pa /etc/netstart
program.
.Sh EXAMPLES
.Pp
.Dl sudo wifi -C ~/.wifi -i iwn0 home
.Pp
.\" .Sh DIAGNOSTICS
.\" For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only.
.Sh SEE ALSO
.Xr ifconfig 1 ,
.Xr hostname.if 5
.\" .Sh STANDARDS
.\" .Sh HISTORY
.Sh AUTHORS
.An "Mike Burns" Aq [hidden email]
.\" .Sh CAVEATS
.\" .Sh BUGS

===
wifi:
===

#!/bin/sh

usage() {
  echo usage: wifi -C config -i iface nickname
  exit 64
}

args=`getopt "C:i:" $*`

if [ $? -ne 0 ]; then
  usage
fi

set -- $args

while [ $# -ne 0 ]; do
  case "$1" in
    -C)
      config="$2"
      shift; shift
      ;;
    -i)
      iface="$2"
      shift; shift
      ;;
    --)
      shift
      to_connect="$@"
      break
      ;;
  esac
done

if [ -z "$config" -o -z "$iface" -o -z "$to_connect" ]; then
  usage
fi

file="/etc/hostname.$iface"
dhcp_cfg=$(sed -ne "/^${to_connect}:.*dhcp/s/.*: *\(.*\) *dhcp/\1/p" "$config")
rtsol_cfg=$(sed -ne "/^${to_connect}:.*rtsol/s/.*: *\(.*\) *rtsol/\1/p" "$config")

if [ -z "$dhcp_cfg" -a -z "$rtsol_cfg" ]; then
  echo "Could not find '$to_connect' in $config" >&2
  exit 1
fi

echo "# Autogenerated by wifi(1)" > "$file"
echo "# Connection name: '${to_connect}'" >> "$file"

if [ -n "$dhcp_cfg" ]; then
  echo "$dhcp_cfg" >> "$file"
  echo dhcp >> "$file"
fi

if [ -n "$rtsol_cfg" ]; then
  echo "$rtsol_cfg" >> "$file"
  echo rtsol >> "$file"
fi

exec sh /etc/netstart

===
wifi-gtk
===

#!/bin/sh

if [ $# -ne 2 ]; then
  echo usage: wifi-gtk -C config
  exit 64
fi

config="$2"

nwid=$(sed -ne 's/\(.*\):.*/\1/p' "$config" | zenity --list --title Wifi --column nwids)

if [ -n "$nwid" ]; then
  exec /home/mike/.bin/wifi -C "$config" -i iwn0 "$nwid"
fi

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

Mike Burns
In reply to this post by Mihai Popescu-3
On 2016-04-13 19.20.24 +0300, Mihai Popescu wrote:
> So, what is the benefit of typing a text in a text box GUI rather than
> a terminal?
> Again, what is the benefit of displaying a list of wifi networks with
> funny beam sign (which tell you nothing, bytheway) rather that read a
> dBm result from scan option in terminal?

Some people like different UIs than other people. Seems like a strange
thing to be upset about.

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

Mihai Popescu-3
In reply to this post by Implausibility
> Some people like different UIs than other people. Seems like a strange
> thing to be upset about.

Some people like to shoot themselves in the foot. I am not upset about
it, but I don't like to hear screams and ambulance sirens. :-)

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

Chris Bennett
In reply to this post by Mihai Popescu-3
On Wed, Apr 13, 2016 at 07:20:24PM +0300, Mihai Popescu wrote:

> > Maybe it could evolve into a port/package?
>
> So, what is the benefit of typing a text in a text box GUI rather than
> a terminal?
> Again, what is the benefit of displaying a list of wifi networks with
> funny beam sign (which tell you nothing, bytheway) rather that read a
> dBm result from scan option in terminal?
>
> That so called GUI will bring you nothing different from a general
> confusion. WiFi connect is an utility not a graphical application.
>

I'm going to answer that based on my extremely frustrating experiences
with my father who no longer has decent short-term memory.

I can explain to him, show him, write down for him, etc. how to use
dhclient and ifconfig. Over and over. He just can't get that or mounting
a flash drive.

This is a never ending problem. For example, we travel a lot. What do
you do at a hotel with six wifi hotspots with wpa and they are all crap?

ifconfig is great. A little too great and informative for him. At this
point, he refuses to read manual pages. Too confusing.

Perhaps a diff for ifconfig would be helpful.

-W wifi only
-s simple output (nwid, bssid, almost nothing else)

# ifconfig                                                                                                                      
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 32768
        priority: 0
        groups: lo
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet 127.0.0.1 netmask 0xff000000
xl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        lladdr 00:08:74:96:ba:e5
        priority: 0
        media: Ethernet autoselect (100baseTX full-duplex)
        status: active
        inet 192.168.44.111 netmask 0xffffff00 broadcast 192.168.44.255
enc0: flags=0<>
        priority: 0
        groups: enc
        status: active
pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33192
        priority: 0
        groups: pflog
bwi0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        lladdr 00:16:01:18:d1:9e
        priority: 4
        groups: wlan egress
        media: IEEE802.11 autoselect (OFDM36 mode 11g)
        status: active
        ieee80211: nwid IliumLT500 chan 6 bssid bc:44:34:1e:51:52 40dBm
wpakey 0xeb192b9fce29f97cc5c1d9c614ecf663a7370cd655b76e82b01c9111738d1dae
wpaprotos wpa1,wpa2 wpaakms psk wpaciphers tkip,ccmp wpagroupcipher tkip
        inet 192.168.43.71 netmask 0xffffff00 broadcast 192.168.43.255


This is just too much for someone like him too make any sense of.


Personally, I hate GUI crap. But there are people who actually NEED it.
He is as firmly dedicated to using OpenBSD as I am.

I bought a second hand computer that has windows 7 on it.
If we bring that up while any USB OpenBSD drives are plugged in,
the first thing to appear on the screen is that we need to format those disks!
Disturbing.

Chris Bennett

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

Mariano Baragiola-2
On 04/14/16 11:50, Chris Bennett wrote:
>
> Personally, I hate GUI crap. But there are people who actually NEED it.
> He is as firmly dedicated to using OpenBSD as I am.
>

And this is why my 62-year-old mother has Debian installed on her
laptop instead of OpenBSD. She travels a lot, too. And I am not around
to "fix" her wifi.

I don't think people refusing to use a shell is an OpenBSD problem, but
I see your point and I think a GUI for managing wifi connections would
be useful.

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

gsowww
A GUI reduces the learning curve needed, however would not the traditional *nix command line card index updated to the modern desktop do the job just as well.

Reply | Threaded
Open this post in threaded view
|

Re: Getting started with an OpenBSD Desktop...

lists-2
In reply to this post by Mike Burns
Wed, 13 Apr 2016 18:34:43 +0200 Mike Burns <[hidden email]>
> On 2016-04-13 15.31.36 +0200, Erling Westenvik wrote:
> > On Wed, Apr 13, 2016 at 09:37:53AM +0000, Mike Burns wrote:  
> > > I hooked some shell scripts up with zenity to make a wifi GUI.
> > >  
> > Interesting. Care to share the code somewhere? Maybe it could evolve
> > into a port/package?  
>
> I'll share the code, but it has some caveats:

It's a starting point for all programs, feedback helps a lot.

> - I made this for my laptop and my use cases.

You're very interested in it, which is what it takes indeed.

> - I hate automation.

Just design correct to be susceptible to automation is enough.
Programs evolve into filters and interfaces to other programs.

> - It's not very good.

The future is open, if you keep your interest in it, buckle up.

> - The GUI gives no feedback after you select the access point.

Minor convenience details, you'll have more iterations with it.

> Feel free to turn it into anything you'd like.

Thanks a bunch, please keep it up (don't listen to crappy talk).

> Attached is a man page for wifi(1), the wifi script itself, and wifi-gtk
> which makes use of the wifi script. Run it as 'doas wifi-gtk -C $HOME/.wifi',
> where $HOME/.wifi is your wifi config (see the attached man page).
>
> ===
> wifi.1:
> ===
>
> .Dd $Mdocdate$
> .Dt WIFI 1
> .Os
> .Sh WIFI
> .Nm wifi
> .Nd connect to OpenBSD wifi
> .Sh SYNOPSIS
> .Nm progname
> .Fl C Ar config
> .Fl i Ar iface
> .Ar nickname
> .Sh DESCRIPTION
> The
> .Nm
> utility connects to the wifi on the interface
> .Ar iface
> according to the
> .Ar nickname
> as read from
> .Ar config .
> .\" .Sh ENVIRONMENT
> .\" For sections 1, 6, 7, and 8 only.
> .Sh FILES
> The configuration file follows a simple format:
> .Pp
> .Dl nickname: ifconfig-options autoconfiguration
> .Pp
> These three values are as follow:
> .Bl -tag -width Ds
> .It Va nickname
> The name of the wifi network, to be passed to the
> .Nm
> program.
> .It Va ifconfig-options
> Options for
> .Xr ifconfig 1 ,
> such as
> .Li nwid
> and
> .Li wpakey .
> .It Va autoconfiguration
> Either
> .Li dhcp
> for DHCP or
> .Li rtsol
> for IPv6 autoconf.
> .El
> .Sh EXIT STATUS
> The exit status of
> .Nm
> is the same as the exit status of the
> .Pa /etc/netstart
> program.
> .Sh EXAMPLES
> .Pp
> .Dl sudo wifi -C ~/.wifi -i iwn0 home
> .Pp
> .\" .Sh DIAGNOSTICS
> .\" For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only.
> .Sh SEE ALSO
> .Xr ifconfig 1 ,
> .Xr hostname.if 5
> .\" .Sh STANDARDS
> .\" .Sh HISTORY
> .Sh AUTHORS
> .An "Mike Burns" Aq [hidden email]
> .\" .Sh CAVEATS
> .\" .Sh BUGS
>
> ===
> wifi:
> ===
>
> #!/bin/sh
>
> usage() {
>   echo usage: wifi -C config -i iface nickname
>   exit 64
> }
>
> args=`getopt "C:i:" $*`
>
> if [ $? -ne 0 ]; then
>   usage
> fi
>
> set -- $args
>
> while [ $# -ne 0 ]; do
>   case "$1" in
>     -C)
>       config="$2"
>       shift; shift
>       ;;
>     -i)
>       iface="$2"
>       shift; shift
>       ;;
>     --)
>       shift
>       to_connect="$@"
>       break
>       ;;
>   esac
> done
>
> if [ -z "$config" -o -z "$iface" -o -z "$to_connect" ]; then
>   usage
> fi
>
> file="/etc/hostname.$iface"
> dhcp_cfg=$(sed -ne "/^${to_connect}:.*dhcp/s/.*: *\(.*\) *dhcp/\1/p" "$config")
> rtsol_cfg=$(sed -ne "/^${to_connect}:.*rtsol/s/.*: *\(.*\) *rtsol/\1/p" "$config")
>
> if [ -z "$dhcp_cfg" -a -z "$rtsol_cfg" ]; then
>   echo "Could not find '$to_connect' in $config" >&2
>   exit 1
> fi
>
> echo "# Autogenerated by wifi(1)" > "$file"
> echo "# Connection name: '${to_connect}'" >> "$file"
>
> if [ -n "$dhcp_cfg" ]; then
>   echo "$dhcp_cfg" >> "$file"
>   echo dhcp >> "$file"
> fi
>
> if [ -n "$rtsol_cfg" ]; then
>   echo "$rtsol_cfg" >> "$file"
>   echo rtsol >> "$file"
> fi
>
> exec sh /etc/netstart
>
> ===
> wifi-gtk
> ===
>
> #!/bin/sh
>
> if [ $# -ne 2 ]; then
>   echo usage: wifi-gtk -C config
>   exit 64
> fi
>
> config="$2"
>
> nwid=$(sed -ne 's/\(.*\):.*/\1/p' "$config" | zenity --list --title Wifi --column nwids)
>
> if [ -n "$nwid" ]; then
>   exec /home/mike/.bin/wifi -C "$config" -i iwn0 "$nwid"
> fi