[arch-releng] [PATCH] 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. --- src/core/libs/lib-network.sh | 95 +++++++++++++++++++---------------- src/core/libs/lib-ui-interactive.sh | 2 +- src/core/procedures/base | 11 ---- src/core/procedures/interactive | 17 ------ 4 files changed, 52 insertions(+), 73 deletions(-) diff --git a/src/core/libs/lib-network.sh b/src/core/libs/lib-network.sh index bc17898..d374dbf 100644 --- a/src/core/libs/lib-network.sh +++ b/src/core/libs/lib-network.sh @@ -6,48 +6,55 @@ # 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 + 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 19a0cbb..6175689 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 () { -- 1.7.3.4
sucess! aif is getting simpler and simpler ;) thanks, Dieter
participants (2)
-
Dieter Plaetinck
-
pyther@pyther.net