summaryrefslogtreecommitdiffstats
path: root/abs/mv-core/MythVantage-config/networkconfig.sh
diff options
context:
space:
mode:
Diffstat (limited to 'abs/mv-core/MythVantage-config/networkconfig.sh')
-rw-r--r--abs/mv-core/MythVantage-config/networkconfig.sh94
1 files changed, 59 insertions, 35 deletions
diff --git a/abs/mv-core/MythVantage-config/networkconfig.sh b/abs/mv-core/MythVantage-config/networkconfig.sh
index 999ccb0..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
@@ -78,9 +94,13 @@ function setup_interfaces() {
TEMPNET=HostGW$1
eval GW=\$${TEMPNET}
+ TEMPNET=HOST_iswireless$1
+ eval wireless=\$${TEMPNET}
- if [ $1 = wlan0 -o $1 = wlan1 ]
+
+
+ if [ x$wireless = x1 ]
then
IS_WIRELESS=TRUE
TEMPNET=HostESSID$1
@@ -106,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 ]
@@ -135,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
@@ -164,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 {
@@ -193,30 +221,25 @@ kill_dhcp
}
function vnc_check() {
- if [ x$RESTART_NETWORK = xfalse ]
+ CMDLINE=$(cat /proc/cmdline)
+ echo $CMDLINE |grep -q vnc
+ USEVNC=$?
+ echo $CMDLINE |grep -q nfsroot
+ NETBOOT=$?
+ echo $USEVNC
+ if [ ! x$USEVNC = x0 ]
then
- echo "netboot install or image creating, will not restart network"
- USEVNC=0
- else
- CMDLINE=$(cat /proc/cmdline)
- echo $CMDLINE |grep -q vnc
- USEVNC=$?
- echo $CMDLINE |grep -q nfsroot
- NETBOOT=$?
- echo $USEVNC
- if [ ! x$USEVNC = x0 ]
+ echo "not using vnc"
+ if [ ! x$NETBOOT = x0 ]
then
- echo "not using vnc"
- if [ ! x$NETBOOT = x0 ]
- then
- echo "not using netboot"
- else
- echo "using netboot"
- USEVNC=0
- fi
+ echo "not using netboot"
else
- echo " using vnc"
+ echo "using netboot"
+ USEVNC=0
fi
+
+ else
+ echo " using vnc"
fi
}
@@ -234,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