summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpyther@pyther.net <pyther@pyther.net>2011-01-02 13:16:53 -0500
committerDieter Plaetinck <dieter@plaetinck.be>2011-01-02 19:30:15 +0100
commit0a5c3d98148becd45707d011900d83dc1d94c0cf (patch)
tree1d7718d6c0038ff027a0472b4c7e38f787bf0d66
parent270e5760ad2495ba4e245840335ec5d1e05cbd1e (diff)
Call target_configure_network directly instead of worker_auto_network.
Will call target_configure_network instead of worker_auto_network in preconfigure_target. Calling worker_auto_network during worker_configure_system caused worker_configure_system to never set a return code. Calling target_configure_network follows the same format as other methods in preconfigure_target() worker_auto_network has been removed since no other function calls it. Signed-off-by: Dieter Plaetinck <dieter@plaetinck.be>
-rw-r--r--src/core/libs/lib-network.sh97
-rw-r--r--src/core/libs/lib-ui-interactive.sh2
-rw-r--r--src/core/procedures/base11
-rw-r--r--src/core/procedures/interactive17
4 files changed, 54 insertions, 73 deletions
diff --git a/src/core/libs/lib-network.sh b/src/core/libs/lib-network.sh
index bc17898..41eb27f 100644
--- a/src/core/libs/lib-network.sh
+++ b/src/core/libs/lib-network.sh
@@ -6,48 +6,57 @@
# we assume that you checked whether networking has been setup before calling us
target_configure_network()
{
- source $RUNTIME_DIR/aif-network-settings 2>/dev/null || return 1
-
- IFO=${INTERFACE_PREV:-eth0} # old iface: a previously entered one, or the arch default
- IFN=${INTERFACE:-eth0} # new iface: a specified one, or the arch default
-
- # comment out any existing uncommented entries, whether specified by us, or arch defaults.
- for var in eth0 $IFO INTERFACES gateway ROUTES
- do
- sed -i "s/^$var=/#$var=/" ${var_TARGET_DIR}/etc/rc.conf || return 1
- done
- sed -i "s/^nameserver/#nameserver/" ${var_TARGET_DIR}/etc/resolv.conf || return 1
- if [ -f ${var_TARGET_DIR}/etc/profile.d/proxy.sh ]
- then
- sed -i "s/^export/#export/" ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
- fi
-
- if [ "$DHCP" = 0 ] ; then
- local line="$IFN=\"$IFN ${IPADDR:-192.168.0.2} netmask ${SUBNET:-255.255.255.0} broadcast ${BROADCAST:-192.168.0.255}\""
- append_after_last "/$IFO\|eth0/" "$line" ${var_TARGET_DIR}/etc/rc.conf || return 1
-
- if [ -n "$GW" ]; then
- append_after_last "/gateway/" "gateway=\"default gw $GW\"" ${var_TARGET_DIR}/etc/rc.conf || return 1
- append_after_last "/ROUTES/" "ROUTES=(gateway)" ${var_TARGET_DIR}/etc/rc.conf || return 1
- fi
- if [ -n "$DNS" ]
- then
- echo "nameserver $DNS" >> ${var_TARGET_DIR}/etc/resolv.conf || return 1
- fi
- else
- append_after_last "/$IFO\|eth0/" "$IFN=\"dhcp\"" ${var_TARGET_DIR}/etc/rc.conf || return 1
- fi
-
- append_after_last "/$IFO\|eth0/" "INTERFACES=($IFN)" ${var_TARGET_DIR}/etc/rc.conf || return 1
-
- if [ -n "$PROXY_HTTP" ]; then
- echo "export http_proxy=$PROXY_HTTP" >> ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
- chmod a+x ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
- fi
-
- if [ -n "$PROXY_FTP" ]; then
- echo "export ftp_proxy=$PROXY_FTP" >> ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
- chmod a+x ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
- fi
- return 0
+ # networking setup could have happened in a separate process (eg partial-configure-network),
+ # so check if the settings file was created to be sure
+ if [ -f $RUNTIME_DIR/aif-network-settings ]; then
+
+ debug NETWORK "Configuring network settings on target system according to installer settings"
+
+ source $RUNTIME_DIR/aif-network-settings 2>/dev/null || return 1
+
+ IFO=${INTERFACE_PREV:-eth0} # old iface: a previously entered one, or the arch default
+ IFN=${INTERFACE:-eth0} # new iface: a specified one, or the arch default
+
+ # comment out any existing uncommented entries, whether specified by us, or arch defaults.
+ for var in eth0 $IFO INTERFACES gateway ROUTES
+ do
+ sed -i "s/^$var=/#$var=/" ${var_TARGET_DIR}/etc/rc.conf || return 1
+ done
+ sed -i "s/^nameserver/#nameserver/" ${var_TARGET_DIR}/etc/resolv.conf || return 1
+ if [ -f ${var_TARGET_DIR}/etc/profile.d/proxy.sh ]
+ then
+ sed -i "s/^export/#export/" ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
+ fi
+
+ if [ "$DHCP" = 0 ] ; then
+ local line="$IFN=\"$IFN ${IPADDR:-192.168.0.2} netmask ${SUBNET:-255.255.255.0} broadcast ${BROADCAST:-192.168.0.255}\""
+ append_after_last "/$IFO\|eth0/" "$line" ${var_TARGET_DIR}/etc/rc.conf || return 1
+
+ if [ -n "$GW" ]; then
+ append_after_last "/gateway/" "gateway=\"default gw $GW\"" ${var_TARGET_DIR}/etc/rc.conf || return 1
+ append_after_last "/ROUTES/" "ROUTES=(gateway)" ${var_TARGET_DIR}/etc/rc.conf || return 1
+ fi
+ if [ -n "$DNS" ]
+ then
+ echo "nameserver $DNS" >> ${var_TARGET_DIR}/etc/resolv.conf || return 1
+ fi
+ else
+ append_after_last "/$IFO\|eth0/" "$IFN=\"dhcp\"" ${var_TARGET_DIR}/etc/rc.conf || return 1
+ fi
+
+ append_after_last "/$IFO\|eth0/" "INTERFACES=($IFN)" ${var_TARGET_DIR}/etc/rc.conf || return 1
+
+ if [ -n "$PROXY_HTTP" ]; then
+ echo "export http_proxy=$PROXY_HTTP" >> ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
+ chmod a+x ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
+ fi
+
+ if [ -n "$PROXY_FTP" ]; then
+ echo "export ftp_proxy=$PROXY_FTP" >> ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
+ chmod a+x ${var_TARGET_DIR}/etc/profile.d/proxy.sh || return 1
+ fi
+ else
+ debug NETWORK "Skipping Host Network Configuration - aif-network-settings not found"
+ fi
+ return 0
}
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh
index 506560e..aa2c456 100644
--- a/src/core/libs/lib-ui-interactive.sh
+++ b/src/core/libs/lib-ui-interactive.sh
@@ -23,7 +23,7 @@ preconfigure_target () {
target_configure_initial_locale || failed+=('initial locale')
target_configure_initial_keymap_font || failed+=('keymap/font setting')
target_configure_fstab || failed+=('fstab configuration')
- execute worker auto_network || failed+=('network config export')
+ target_configure_network || failed+=('network config export')
target_configure_mirrorlist || failed+=('mirrorlist configuration')
target_configure_time || failed+=('time configuration')
target_configure_initcpio || failed+=('initcpio configuration')
diff --git a/src/core/procedures/base b/src/core/procedures/base
index b6f0ea4..ab95cea 100644
--- a/src/core/procedures/base
+++ b/src/core/procedures/base
@@ -142,17 +142,6 @@ worker_install_packages ()
installpkg
}
-
-worker_auto_network ()
-{
- if [ -f $RUNTIME_DIR/aif-network-settings ]
- then
- target_configure_network || return $?
- fi
- return 0
-}
-
-
worker_configure_system ()
{
preconfigure_target
diff --git a/src/core/procedures/interactive b/src/core/procedures/interactive
index 179866c..f499a4b 100644
--- a/src/core/procedures/interactive
+++ b/src/core/procedures/interactive
@@ -167,23 +167,6 @@ worker_install_bootloader ()
interactive_install_bootloader
}
-
-worker_auto_network ()
-{
- # if the user has been through networking setup, it may be useful to export the users' choices to the target system
- # networking setup could have happened in a separate process (eg partial-configure-network), so check if the settings file was created to be sure
- if [ -f $RUNTIME_DIR/aif-network-settings ]
- 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
- if ! target_configure_network
- then
- show_warning "Automatic network settings propagation failed" "Failed to import current network settings into target system"
- return 1
- fi
- fi
- return 0
-}
-
# override show_report because this procedure does not use phases, but it's own menu
show_report ()
{