| 1 |
#!/bin/bash
|
| 2 |
# Copyright 1999-2005 Gentoo Foundation
|
| 3 |
# Distributed under the terms of the GNU General Public License v2
|
| 4 |
# $Header: /var/cvsroot/gentoo/src/livecd-tools/net-setup,v 1.19 2006/05/30 20:20:11 wolf31o2 Exp $
|
| 5 |
|
| 6 |
if [ -f /sbin/livecd-functions.sh ]
|
| 7 |
then
|
| 8 |
source /sbin/livecd-functions.sh
|
| 9 |
else
|
| 10 |
echo "ERROR: /sbin/livecd-functions.sh could not be loaded!"
|
| 11 |
exit 1
|
| 12 |
fi
|
| 13 |
|
| 14 |
if [ ! -x $(which dialog) ]
|
| 15 |
then
|
| 16 |
echo "ERROR: The dialog utility is required for net-setup. Exiting!"
|
| 17 |
exit 1
|
| 18 |
fi
|
| 19 |
|
| 20 |
livecd_check_root || exit 1
|
| 21 |
|
| 22 |
# Hide any potential error messages from the readlink/dirname/etc calls below
|
| 23 |
exec 2>/dev/null
|
| 24 |
|
| 25 |
if [ -z "${1}" ]
|
| 26 |
then
|
| 27 |
show_ifmenu
|
| 28 |
echo $iface
|
| 29 |
else
|
| 30 |
iface="${1}"
|
| 31 |
fi
|
| 32 |
|
| 33 |
[ ! -d /tmp/setup.opts ] && mkdir /tmp/setup.opts
|
| 34 |
cd /tmp/setup.opts
|
| 35 |
|
| 36 |
while true; do
|
| 37 |
show_ifconfirm $iface
|
| 38 |
[[ $result == "yes" ]] && break
|
| 39 |
show_ifmenu
|
| 40 |
done
|
| 41 |
|
| 42 |
# Show stderr again
|
| 43 |
exec 2>/dev/stderr
|
| 44 |
|
| 45 |
dialog --title "Network setup" --menu "This script is designed to setup both wired and wireless network settings. All questions below apply to the ${iface} interface only. Choose one option:" 20 60 7 1 "My network is wireless" 2 "My network is wired" 2> ${iface}.WIRED_WIRELESS
|
| 46 |
WIRED_WIRELESS="$(cat ${iface}.WIRED_WIRELESS)"
|
| 47 |
case ${WIRED_WIRELESS} in
|
| 48 |
1)
|
| 49 |
livecd_config_wireless
|
| 50 |
livecd_config_ip
|
| 51 |
livecd_write_wireless_conf
|
| 52 |
;;
|
| 53 |
2)
|
| 54 |
livecd_config_ip
|
| 55 |
;;
|
| 56 |
*)
|
| 57 |
exit 0
|
| 58 |
;;
|
| 59 |
esac
|
| 60 |
livecd_write_net_conf
|
| 61 |
|
| 62 |
echo "Type \"ifconfig\" to make sure the interface was configured correctly."
|
| 63 |
|
| 64 |
# vim: ts=4
|