diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2010-12-28 17:56:00 +0100 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2010-12-28 17:56:00 +0100 |
commit | 25f7a0471340e8d6c2b37e3c75aa7d0ae209d09d (patch) | |
tree | 8a5c921946125e659df4adf4b2baf733c764d482 /src/core/libs/lib-network.sh | |
parent | febffe7a9f6d7dd27eb7e382e11ea9fbda62bb26 (diff) |
cleanup worker_auto_network() / target_configure_network() code
The only thing needed to know before calling target_configure_network()
is whether $RUNTIME_DIR/aif-network-settings exists; if that exists,
network setup has been run sucessfully and all values are known.
It's up to target_configure_network() to source that, which means
worker_auto_network() functions can become simpler.
Also, variable name cleanup: s/S_DHCP/DHCP/
Diffstat (limited to 'src/core/libs/lib-network.sh')
-rw-r--r-- | src/core/libs/lib-network.sh | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/core/libs/lib-network.sh b/src/core/libs/lib-network.sh index 19d4862..aa961ce 100644 --- a/src/core/libs/lib-network.sh +++ b/src/core/libs/lib-network.sh @@ -1,17 +1,13 @@ #!/bin/bash -# auto_network(). # configures network on host system according to installer settings # if some variables are not set, we handle that transparantly -# $1 dhcp/fixed -# $2 http proxy (optional. defaults to '') -# $3 ftp proxy (optional. defaults to '') +# however, at least $DHCP must be set, so we know what do to +# we assume that you checked whether networking has been setup before calling us target_configure_network() { - [ "$1" != dhcp -a "$1" != fixed ] && die_error "target_configure_network \$1 must be 'dhcp' or 'fixed'" - PROXY_HTTP="$2" - PROXY_FTP="$3" - if [ "$1" = fixed ]; then + source $RUNTIME_DIR/aif-network-settings 2>/dev/null || return 1 + if [ "$DHCP" = 0 ] ; then sed -i "s/#eth0=\"eth0/eth0=\"eth0/g" ${var_TARGET_DIR}/etc/rc.conf || return 1 sed -i "s/^eth0=\"dhcp/#eth0=\"dhcp/g" ${var_TARGET_DIR}/etc/rc.conf || return 1 sed -i "s#eth0=\"eth0#${INTERFACE:-eth0}=\"${INTERFACE:-eth0}#g" ${var_TARGET_DIR}/etc/rc.conf || return 1 |