| 1 | #!/bin/bash |
1 | #!/bin/bash |
| 2 | # Copyright 1999-2005 Gentoo Foundation |
2 | # Copyright 1999-2005 Gentoo Foundation |
| 3 | # Distributed under the terms of the GNU General Public License v2 |
3 | # Distributed under the terms of the GNU General Public License v2 |
| 4 | # $Header: /var/cvsroot/gentoo/src/livecd-tools/livecd-functions.sh,v 1.23 2006/05/30 20:20:11 wolf31o2 Exp $ |
4 | # $Header: /var/cvsroot/gentoo/src/livecd-tools/livecd-functions.sh,v 1.24 2006/06/14 14:48:07 wolf31o2 Exp $ |
| 5 | |
5 | |
| 6 | # Global Variables: |
6 | # Global Variables: |
| 7 | # CDBOOT -- is booting off CD |
7 | # CDBOOT -- is booting off CD |
| 8 | # LIVECD_CONSOLE -- console that is specified to kernel commandline |
8 | # LIVECD_CONSOLE -- console that is specified to kernel commandline |
| 9 | # -- (ttyS0, tty1, etc). Only defined if passed to kernel |
9 | # -- (ttyS0, tty1, etc). Only defined if passed to kernel |
| … | |
… | |
| 121 | fi |
121 | fi |
| 122 | } |
122 | } |
| 123 | |
123 | |
| 124 | livecd_config_wireless() { |
124 | livecd_config_wireless() { |
| 125 | cd /tmp/setup.opts |
125 | cd /tmp/setup.opts |
|
|
126 | [ -x /usr/sbin/iwconfig ] && iwconfig=/usr/sbin/iwconfig |
|
|
127 | [ -x /sbin/iwconfig ] && iwconfig=/sbin/iwconfig |
| 126 | dialog --title "SSID" --inputbox "Please enter your SSID, or leave blank for selecting the nearest open network" 20 50 2> ${iface}.SSID |
128 | dialog --title "SSID" --inputbox "Please enter your SSID, or leave blank for selecting the nearest open network" 20 50 2> ${iface}.SSID |
| 127 | SSID="$(cat ${iface}.SSID)" |
129 | SSID="$(cat ${iface}.SSID)" |
| 128 | if [ -n "${SSID}" ] |
130 | if [ -n "${SSID}" ] |
| 129 | then |
131 | then |
| 130 | dialog --title "WEP (Part 1)" --menu "Does your network use encryption?" 20 60 7 1 "Yes" 2 "No" 2> ${iface}.WEP |
132 | dialog --title "WEP (Part 1)" --menu "Does your network use encryption?" 20 60 7 1 "Yes" 2 "No" 2> ${iface}.WEP |
| … | |
… | |
| 135 | WEP_TYPE="$(cat ${iface}.WEPTYPE)" |
137 | WEP_TYPE="$(cat ${iface}.WEPTYPE)" |
| 136 | case ${WEP_TYPE} in |
138 | case ${WEP_TYPE} in |
| 137 | 1) |
139 | 1) |
| 138 | dialog --title "WEP (Part 3)" --inputbox "Please enter your WEP key in the form of XXXX-XXXX-XX for 64-bit or XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX for 128-bit" 20 50 2> ${iface}.WEPKEY |
140 | dialog --title "WEP (Part 3)" --inputbox "Please enter your WEP key in the form of XXXX-XXXX-XX for 64-bit or XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX for 128-bit" 20 50 2> ${iface}.WEPKEY |
| 139 | WEP_KEY="$(cat ${iface}.WEPKEY)" |
141 | WEP_KEY="$(cat ${iface}.WEPKEY)" |
| 140 | if [ -n "${WEP_KEY}" -a -x /usr/sbin/iwconfig ] |
142 | if [ -n "${WEP_KEY}" ] |
| 141 | then |
143 | then |
| 142 | /usr/sbin/iwconfig ${iface} essid "${SSID}" |
144 | ${iwconfig} ${iface} essid "${SSID}" |
| 143 | /usr/sbin/iwconfig ${iface} key "${WEP_KEY}" |
145 | ${iwconfig} ${iface} key "${WEP_KEY}" |
| 144 | fi |
146 | fi |
| 145 | ;; |
147 | ;; |
| 146 | 2) |
148 | 2) |
| 147 | dialog --title "WEP (Part 3)" --inputbox "Please enter your WEP key in ASCII form. This should be 5 or 13 characters for either 64-bit or 128-bit encryption, repectively" 20 50 2> ${iface}.WEPKEY |
149 | dialog --title "WEP (Part 3)" --inputbox "Please enter your WEP key in ASCII form. This should be 5 or 13 characters for either 64-bit or 128-bit encryption, repectively" 20 50 2> ${iface}.WEPKEY |
| 148 | WEP_KEY="$(cat ${iface}.WEPKEY)" |
150 | WEP_KEY="$(cat ${iface}.WEPKEY)" |
| 149 | if [ -n "${WEP_KEY}" -a -x /usr/sbin/iwconfig ] |
151 | if [ -n "${WEP_KEY}" ] |
| 150 | then |
152 | then |
| 151 | /usr/sbin/iwconfig ${iface} essid "${SSID}" |
153 | ${iwconfig} ${iface} essid "${SSID}" |
| 152 | /usr/sbin/iwconfig ${iface} key "s:${WEP_KEY}" |
154 | ${iwconfig} ${iface} key "s:${WEP_KEY}" |
| 153 | fi |
155 | fi |
| 154 | ;; |
156 | ;; |
| 155 | esac |
157 | esac |
| 156 | ;; |
158 | ;; |
| 157 | 2) |
159 | 2) |
| 158 | /usr/sbin/iwconfig ${iface} essid "${SSID}" |
160 | ${iwconfig} ${iface} essid "${SSID}" |
| 159 | /usr/sbin/iwconfig ${iface} key off |
161 | ${iwconfig} ${iface} key off |
| 160 | ;; |
162 | ;; |
| 161 | esac |
163 | esac |
| 162 | fi |
164 | fi |
| 163 | } |
165 | } |
| 164 | |
166 | |