/[livecd-tools]/trunk/livecd-functions.sh
Gentoo

Diff of /trunk/livecd-functions.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 74 Revision 75
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.12 2005/07/07 19:52:42 wolf31o2 Exp $ 4# $Header: /var/cvsroot/gentoo/src/livecd-tools/livecd-functions.sh,v 1.13 2005/08/16 19:02:33 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
133livecd_write_wireless_conf() { 133livecd_write_wireless_conf() {
134 cd /tmp/setup.opts 134 cd /tmp/setup.opts
135 SSID="$(cat ${iface}.SSID)" 135 SSID="$(cat ${iface}.SSID)"
136 if [ -n "${SSID}" ] 136 if [ -n "${SSID}" ]
137 then 137 then
138 WEP_TYPE="$(cat ${iface}.WEPTYPE)"
139 if [ -n "${WEP_TYPE}" ]
140 then
141 WEP_KEY="$(cat ${iface}.WEPKEY)"
142 if [ -n "${WEP_KEY}" ]
143 then
144 SSID_TRANS="$(echo ${SSID//[![:word:]]/_})"
145 echo "# This wireless configuration file was built by net-setup" > /etc/conf.d/wireless 138 echo "# This wireless configuration file was built by net-setup" > /etc/conf.d/wireless
139 WEP="$(cat ${iface}.WEPTYPE)"
140 case ${WEP} in
141 1)
142 WEP_TYPE="$(cat ${iface}.WEPTYPE)"
143 if [ -n "${WEP_TYPE}" ]
144 then
145 WEP_KEY="$(cat ${iface}.WEPKEY)"
146 if [ -n "${WEP_KEY}" ]
147 then
148 SSID_TRANS="$(echo ${SSID//[![:word:]]/_})"
146 case ${WEP_TYPE} in 149 case ${WEP_TYPE} in
147 1) 150 1)
148 echo "key_${SSID_TRANS}=\"${WEP_KEY} enc open\"" >> /etc/conf.d/wireless 151 echo "key_${SSID_TRANS}=\"${WEP_KEY} enc open\"" >> /etc/conf.d/wireless
149 ;; 152 ;;
150 2) 153 2)
151 echo "key_${SSID_TRANS}=\"s:${WEP_KEY} enc open\"" >> /etc/conf.d/wireless 154 echo "key_${SSID_TRANS}=\"s:${WEP_KEY} enc open\"" >> /etc/conf.d/wireless
152 ;; 155 ;;
153 esac 156 esac
157 fi
158 fi
159 ;;
160 2)
161 :
162 ;;
163 esac
154 echo "preferred_aps=( \"${SSID}\" )" >> /etc/conf.d/wireless 164 echo "preferred_aps=( \"${SSID}\" )" >> /etc/conf.d/wireless
155 echo "associate_order=\"forcepreferredonly\"" >> /etc/conf.d/wireless 165 echo "associate_order=\"forcepreferredonly\"" >> /etc/conf.d/wireless
156 fi
157 fi
158 fi 166 fi
159} 167}
160 168
161livecd_config_ip() { 169livecd_config_ip() {
162 cd /tmp/setup.opts 170 cd /tmp/setup.opts
163 dialog --title "TCP/IP setup" --menu "You can use DHCP to automatically configure a network interface or you can specify an IP and related settings manually. Choose one option:" 20 60 7 1 "Use DHCP to auto-detect my network settings" 2 "Specify an IP address manually" 2> ${iface}.DHCP 171 dialog --title "TCP/IP setup" --menu "You can use DHCP to automatically configure a network interface or you can specify an IP and related settings manually. Choose one option:" 20 60 7 1 "Use DHCP to auto-detect my network settings" 2 "Specify an IP address manually" 2> ${iface}.DHCP
164 DHCP="$(cat ${iface}.DHCP)" 172 DHCP="$(cat ${iface}.DHCP)"
165 case ${DHCP} in 173 case ${DHCP} in
166 1) 174 1)
167 /sbin/dhcpcd -t 10 -h $(hostname) ${iface} & 175 /sbin/dhcpcd -n -t 10 -h $(hostname) ${iface} &
168 ;; 176 ;;
169 2) 177 2)
170 dialog --title "IP address" --inputbox "Please enter an IP address for ${iface}:" 20 50 "192.168.1.1" 2> ${iface}.IP 178 dialog --title "IP address" --inputbox "Please enter an IP address for ${iface}:" 20 50 "192.168.1.1" 2> ${iface}.IP
171 IP="$(cat ${iface}.IP)" 179 IP="$(cat ${iface}.IP)"
172 BC_TEMP="$(echo $IP|cut -d . -f 1).$(echo $IP|cut -d . -f 2).$(echo $IP|cut -d . -f 3).255" 180 BC_TEMP="$(echo $IP|cut -d . -f 1).$(echo $IP|cut -d . -f 2).$(echo $IP|cut -d . -f 3).255"
340 if [ "${CDBOOT}" = "" ] 348 if [ "${CDBOOT}" = "" ]
341 then 349 then
342 return 1 350 return 1
343 fi 351 fi
344 352
353 # Create a backup
354 cp -f /etc/inittab /etc/inittab.old
355
345 # Comment out current getty settings 356 # Comment out current getty settings
346 sed -i -e '/^c[0-9]/ s/^/#/' /etc/inittab 357 sed -i -e '/^c[0-9]/ s/^/#/' /etc/inittab
347 358
348 # SPARC & HPPA console magic 359 # SPARC & HPPA console magic
349 if [ "${HOSTTYPE}" = "sparc" -o "${HOSTTYPE}" = "hppa" -o "${HOSTTYPE}" = "ppc64" ] 360 if [ "${HOSTTYPE}" = "sparc" -o "${HOSTTYPE}" = "hppa" -o "${HOSTTYPE}" = "ppc64" ]

Legend:
Removed from v.74  
changed lines
  Added in v.75

  ViewVC Help
Powered by ViewVC 1.1.20