Plan 9 from Bell Labs’s /usr/web/sources/contrib/miller/9/bcm/bootwifi.rc

Copyright © 2009 Alcatel-Lucent.
Distributed under the Lucent Public License version 1.02.
Download the Plan 9 distribution.


#!/boot/rc -m /boot/rcmain

wifi=/net/ether1

fn need {
	while (~ $#$1 0) {
		echo -n $1': '
		$1=`{read}
	}
}

fn joinwifi {
	need essid
	echo essid $essid >$wifi/clone
	need wificrypt
	switch ($wificrypt) {
		case wep
			echo crypt wep >$wifi/clone
			need wep_password
			echo key0 $wep_password >$wifi/clone
			rm /env/wep_password
		case wpa wpa1
			wpa -1p $wifi
		case wpa2
			wpa -2p $wifi
	}
}

/boot/echo -n boot...
path=(/bin /boot)
bind '#p' /proc
bind '#d' /fd
bind -a '#P' /dev
bind -a '#t' /dev
bind -a '#S' /dev
bind -a '#I' /net
bind -a '#l0' /net
bind -a '#l1' /net

usbd

need fs
need auth

factotum -u -s factotum -a $auth
joinwifi
ipconfig ether $wifi
srv tcp!$fs!564 boot

rootdir=/root
rootspec=''
mount -c /srv/boot /root
bind -ac $rootdir /
bind -ac $rootdir/mnt /mnt

bind /$cputype/bin /bin
bind -a /rc/bin /bin
path=(. /bin)

if (! ~ $#init 0)
	exec `{echo $init}
if (~ $service cpu)
	exec /$cputype/init -c
if not
	exec /$cputype/init -t
exec /boot/rc -m/boot/rcmain -i

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2009 Alcatel-Lucent. All Rights Reserved.
Comments to webmaster@plan9.bell-labs.com.