From 42129857874c470c65d3b1dcb4bf42945a98dcfa Mon Sep 17 00:00:00 2001 From: James Meyer Date: Wed, 10 Dec 2008 18:49:40 -0600 Subject: Fix interfaces not being disabled when they are in fact disabled in the gui. ref FS#58 --- abs/core-testing/LinHES-config/PKGBUILD | 2 +- abs/core-testing/LinHES-config/networkconfig.sh | 52 ++++++++++++++++++------ abs/core-testing/LinHES-config/systemconfig.sh | 1 + abs/mv-core/MythVantage-config/networkconfig.sh | 53 ++++++++++++++++++------- abs/mv-core/MythVantage-config/systemconfig.sh | 1 + 5 files changed, 81 insertions(+), 28 deletions(-) diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD index 2a8ad77..543d182 100755 --- a/abs/core-testing/LinHES-config/PKGBUILD +++ b/abs/core-testing/LinHES-config/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-config pkgver=1.0 -pkgrel=96 +pkgrel=103 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev ) pkgdesc="Install and configure your system" depends=(bc libstatgrab mysql-python expect curl dnsutils parted sg3_utils nmbscan ) diff --git a/abs/core-testing/LinHES-config/networkconfig.sh b/abs/core-testing/LinHES-config/networkconfig.sh index 9ad2d4e..23e3774 100644 --- a/abs/core-testing/LinHES-config/networkconfig.sh +++ b/abs/core-testing/LinHES-config/networkconfig.sh @@ -43,6 +43,22 @@ fi } +function change_iface_state () { + if [ x$2 = xenabled ] + then + echo "setting $1 to active" + sed -i -e 's/^ONBOOT=.*$/ONBOOT=yes/g' $ETCNETDIR/$1/options + sed -i -e 's/^DISABLED=.*$/DISABLED=no/g' $ETCNETDIR/$1/options + else + echo "setting $1 to inactive" + sed -i -e 's/^ONBOOT=.*$/ONBOOT=no/g' $ETCNETDIR/$1/options + sed -i -e 's/^DISABLED=.*$/DISABLED=yes/g' $ETCNETDIR/$1/options + /sbin/ifconfig $1 down + ip address flush $1 + fi + +} + function setup_interfaces() { local IS_WIRELESS local ip @@ -110,14 +126,17 @@ function setup_interfaces() { cp -f $TEMPLATES/etcnet/eth/options $ETCNETDIR/$1/options fi - if [ x$isactive = x0 ] + if [ x$isactive = x1 ] then - echo "setting $1 to inactive" - sed -i -e 's/^ONBOOT=.*$/ONBOOT=no/g' $ETCNETDIR/$1/options - + change_iface_state $1 enabled + #echo "setting $1 to active" + #sed -i -e 's/^ONBOOT=.*$/ONBOOT=yes/g' $ETCNETDIR/$1/options + #sed -i -e 's/^DISABLED=.*$/DISABLED=no/g' $ETCNETDIR/$1/options else - echo "setting $1 to active" - sed -i -e 's/^ONBOOT=.*$/ONBOOT=yes/g' $ETCNETDIR/$1/options + change_iface_state $1 disabled + #echo "setting $1 to inactive" + #sed -i -e 's/^ONBOOT=.*$/ONBOOT=no/g' $ETCNETDIR/$1/options + #sed -i -e 's/^DISABLED=.*$/DISABLED=yes/g' $ETCNETDIR/$1/options fi if [ x$IS_WIRELESS = xTRUE ] @@ -139,7 +158,7 @@ function setup_interfaces() { - if [ $UseDHCP = 0 ] + if [ x$UseDHCP = x0 ] then echo using dhcp sed -i -e 's/^BOOTPROTO=.*$/BOOTPROTO=dhcp/g' $ETCNETDIR/$1/options @@ -168,11 +187,16 @@ for i in eth0 eth1 wlan0 wlan1 do CURRENTIF="HostActive"$i eval IFSTATE=\$${CURRENTIF} + echo $IFSTATE "---" + echo $i if [ x$IFSTATE = x1 ] then setup_interfaces $i + else + change_iface_state $i disabled fi done + } function setup_hostname { @@ -233,23 +257,25 @@ function setup_MYTH_vars { -function setup_network { - setup_MYTH_vars - setup_hostname - find_active -} function start_network { if [ ! $USEVNC = 0 ] then + /etc/net/scripts/network.init reload /etc/net/scripts/network.init restart - else echo "VNC/NETBOOT in use, will NOT restart network" fi } +function setup_network { + setup_MYTH_vars + setup_hostname + find_active +} + + function stop_network { if [ ! $USEVNC = 0 ] then diff --git a/abs/core-testing/LinHES-config/systemconfig.sh b/abs/core-testing/LinHES-config/systemconfig.sh index f2f20a0..3aac497 100755 --- a/abs/core-testing/LinHES-config/systemconfig.sh +++ b/abs/core-testing/LinHES-config/systemconfig.sh @@ -1081,6 +1081,7 @@ then then echo "loading network" ${BASE}/etc/net/scripts/network.init reload + ${BASE}/etc/net/scripts/network.init restart else echo "netboot, will not start network" fi diff --git a/abs/mv-core/MythVantage-config/networkconfig.sh b/abs/mv-core/MythVantage-config/networkconfig.sh index 9ad2d4e..b4ffd5c 100644 --- a/abs/mv-core/MythVantage-config/networkconfig.sh +++ b/abs/mv-core/MythVantage-config/networkconfig.sh @@ -43,6 +43,22 @@ fi } +function change_iface_state () { + if [ x$2 = xenabled ] + then + echo "setting $1 to active" + sed -i -e 's/^ONBOOT=.*$/ONBOOT=yes/g' $ETCNETDIR/$1/options + sed -i -e 's/^DISABLED=.*$/DISABLED=no/g' $ETCNETDIR/$1/options + else + echo "setting $1 to inactive" + sed -i -e 's/^ONBOOT=.*$/ONBOOT=no/g' $ETCNETDIR/$1/options + sed -i -e 's/^DISABLED=.*$/DISABLED=yes/g' $ETCNETDIR/$1/options + /sbin/ifconfig $1 down + ip address flush $1 + fi + +} + function setup_interfaces() { local IS_WIRELESS local ip @@ -110,14 +126,17 @@ function setup_interfaces() { cp -f $TEMPLATES/etcnet/eth/options $ETCNETDIR/$1/options fi - if [ x$isactive = x0 ] + if [ x$isactive = x1 ] then - echo "setting $1 to inactive" - sed -i -e 's/^ONBOOT=.*$/ONBOOT=no/g' $ETCNETDIR/$1/options - + change_iface_state $1 enabled + #echo "setting $1 to active" + #sed -i -e 's/^ONBOOT=.*$/ONBOOT=yes/g' $ETCNETDIR/$1/options + #sed -i -e 's/^DISABLED=.*$/DISABLED=no/g' $ETCNETDIR/$1/options else - echo "setting $1 to active" - sed -i -e 's/^ONBOOT=.*$/ONBOOT=yes/g' $ETCNETDIR/$1/options + change_iface_state $1 disabled + #echo "setting $1 to inactive" + #sed -i -e 's/^ONBOOT=.*$/ONBOOT=no/g' $ETCNETDIR/$1/options + #sed -i -e 's/^DISABLED=.*$/DISABLED=yes/g' $ETCNETDIR/$1/options fi if [ x$IS_WIRELESS = xTRUE ] @@ -139,7 +158,7 @@ function setup_interfaces() { - if [ $UseDHCP = 0 ] + if [ x$UseDHCP = x0 ] then echo using dhcp sed -i -e 's/^BOOTPROTO=.*$/BOOTPROTO=dhcp/g' $ETCNETDIR/$1/options @@ -168,11 +187,16 @@ for i in eth0 eth1 wlan0 wlan1 do CURRENTIF="HostActive"$i eval IFSTATE=\$${CURRENTIF} + echo $IFSTATE "---" + echo $i if [ x$IFSTATE = x1 ] then setup_interfaces $i + else + change_iface_state $i disabled fi done + } function setup_hostname { @@ -233,23 +257,24 @@ function setup_MYTH_vars { -function setup_network { - setup_MYTH_vars - setup_hostname - find_active -} function start_network { if [ ! $USEVNC = 0 ] then - /etc/net/scripts/network.init restart - + /etc/net/scripts/network.init reload else echo "VNC/NETBOOT in use, will NOT restart network" fi } +function setup_network { + setup_MYTH_vars + setup_hostname + find_active +} + + function stop_network { if [ ! $USEVNC = 0 ] then diff --git a/abs/mv-core/MythVantage-config/systemconfig.sh b/abs/mv-core/MythVantage-config/systemconfig.sh index 6971e8f..5884b69 100755 --- a/abs/mv-core/MythVantage-config/systemconfig.sh +++ b/abs/mv-core/MythVantage-config/systemconfig.sh @@ -1062,6 +1062,7 @@ then then echo "reloading network" ${BASE}/etc/net/scripts/network.init reload + ${BASE}/etc/net/scripts/network.init restart else echo "netboot/vnc, will not restart network" fi -- cgit v0.12