summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2009-08-01 21:32:02 +0200
committerDieter Plaetinck <dieter@plaetinck.be>2009-08-01 21:32:02 +0200
commit985105effdc8c7d80ad9592cf13ff245e71ef826 (patch)
tree8bac18025a471535529d148d7b402169fee2d985 /src/core
parentc70a4c92c554ccca13edcb60b15e12af56d13f60 (diff)
ask to export network settings to target system just before configuring system, also track network settings possibly done in a separate process and misc cleanups/fixes
Diffstat (limited to 'src/core')
-rw-r--r--src/core/libs/lib-ui-interactive.sh18
-rw-r--r--src/core/procedures/base6
-rw-r--r--src/core/procedures/interactive27
3 files changed, 37 insertions, 14 deletions
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh
index b8cad71..e0b7ac8 100644
--- a/src/core/libs/lib-ui-interactive.sh
+++ b/src/core/libs/lib-ui-interactive.sh
@@ -784,15 +784,11 @@ interactive_runtime_network() {
local ifaces
ifaces=$(ifconfig -a |grep "Link encap:Ethernet"|sed 's/ \+Link encap:Ethernet \+HWaddr \+/ /g')
- if [ "$ifaces" = "" ]; then
- notify "Cannot find any ethernet interfaces. This usually means udev was\nunable to load the module and you must do it yourself. Switch to\nanother VT, load the appropriate module, and run this step again."
- return 1
- fi
+ [ -z "$ifaces" ] && show_warning "No network interfaces?" "Cannot find any ethernet interfaces. This usually means udev was\nunable to load the module and you must do it yourself. Switch to\nanother VT, load the appropriate module, and run this step again." && return 1
- ask_option no "Interface selection" "Select a network interface" required $ifaces || return 1 #TODO: code used originaly --nocancel here. what's the use? + make ok button 'select'
+ ask_option no "Interface selection" "Select a network interface" required $ifaces || return 1
INTERFACE=$ANSWER_OPTION
-
if ask_yesno "Do you want to use DHCP?"
then
infofy "Please wait. Polling for DHCP server on $INTERFACE..."
@@ -809,6 +805,7 @@ interactive_runtime_network() {
fi
S_DHCP=1
else
+ S_DHCP=0
NETPARAMETERS=""
while [ "$NETPARAMETERS" = "" ]; do
ask_string "Enter your IP address" "192.168.0.2" || return 1
@@ -854,6 +851,15 @@ interactive_runtime_network() {
fi
echo "nameserver $DNS" >/etc/resolv.conf
fi
+ echo "INTERFACE=$INTERFACE
+ S_DHCP=$S_DHCP
+ IPADDR=$IPADDR
+ SUBNET=$SUBNET
+ BROADCAST=$BROADCAST
+ GW=$GW
+ DNS=$DNS
+ PROXY_HTTP=$PROXY_HTTP
+ PROXY_FTP=$PROXY_FTP" > $RUNTIME_DIR/aif-network-settings
notify "The network is configured."
return 0
}
diff --git a/src/core/procedures/base b/src/core/procedures/base
index 47ebd8a..362afa1 100644
--- a/src/core/procedures/base
+++ b/src/core/procedures/base
@@ -164,8 +164,10 @@ worker_auto_fstab ()
worker_auto_network ()
{
- [ "$S_DHCP" = 1 ] && target_configure_network dhcp "$PROXY_HTTP" "$PROXY_FTP"
- [ "$S_DHCP" != 1 ] && target_configure_network fixed "$PROXY_HTTP" "$PROXY_FTP"
+ [ "$S_DHCP" = 1 ] && target_configure_network dhcp "$PROXY_HTTP" "$PROXY_FTP" && return 0
+ [ "$S_DHCP" = 0 ] && target_configure_network fixed "$PROXY_HTTP" "$PROXY_FTP" && return 0
+ [ "$S_DHCP" != 1 -a "$S_DHCP" != 0 ] && return 0
+ return 1
}
diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive
index 2f492d9..784a33a 100644
--- a/src/core/procedures/interactive
+++ b/src/core/procedures/interactive
@@ -74,12 +74,12 @@ mainmenu()
"5")
check_depend worker package_list && \
check_depend worker select_source && execute worker install_packages && { execute worker auto_fstab ; \
- ended_ok worker runtime_network && execute worker auto_network ; \
execute worker auto_locale ; \
execute worker auto_keymap_font;
true ; } && NEXTITEM=6 ;;
"6")
- check_depend worker install_packages && execute worker configure_system && { execute worker mkinitcpio ; \
+ check_depend worker install_packages && execute worker auto_network && \
+ execute worker configure_system && { execute worker mkinitcpio ; \
execute worker locales ;
execute worker initialtime ;
true ; } && NEXTITEM=7 ;;
@@ -167,8 +167,23 @@ worker_install_bootloader ()
worker_auto_network ()
{
- ask_yesno "Do you want to use the network settings from the installer in rc.conf and resolv.conf?\n\nIf you used Proxy settings, they will be written to /etc/profile.d/proxy.sh" || return 0
-
- [ "$S_DHCP" = 1 ] && target_configure_network dhcp "$PROXY_HTTP" "$PROXY_FTP"
- [ "$S_DHCP" != 1 ] && target_configure_network fixed "$PROXY_HTTP" "$PROXY_FTP"
+ ask=0
+ # if the user has been through networking setup and if any of these variables is set, it may be useful to export the users' choices to the target system
+ if [ "$S_DHCP" = 1 -o "$S_DHCP" = 0 ] && [ -n "$PROXY_HTTP$PROXY_FTP$DNS$INTERFACE$SUBNET$GW$BROADCAST" ]
+ then
+ ask=1
+ # if the variables are not set but the network settings file exists, the user has probably run the runtime_network in a separate process (eg partial-configure-network)
+ # in that case, lets source the file and check again
+ elif [ -f $RUNTIME_DIR/aif-network-settings ] && source $RUNTIME_DIR/aif-network-settings && [ "$S_DHCP" = 1 -o "$S_DHCP" = 0 ] && [ -n "$PROXY_HTTP$PROXY_FTP$DNS$INTERFACE$SUBNET$GW$BROADCAST" ]
+ then
+ ask=1
+ fi
+ if [ "$ask" = 1 ]
+ then
+ ask_yesno "Do you want to use the network settings from the installer in rc.conf and resolv.conf?\n\nIf you used Proxy settings, they will be written to /etc/profile.d/proxy.sh" || return 0
+ [ "$S_DHCP" = 1 ] && target_configure_network dhcp "$PROXY_HTTP" "$PROXY_FTP" && return 0
+ [ "$S_DHCP" = 0 ] && target_configure_network fixed "$PROXY_HTTP" "$PROXY_FTP" && return 0
+ show_warning "Automatic network settings propagation failed" "Failed to import current network settings into target system"
+ return 1
+ fi
}