aboutsummaryrefslogtreecommitdiff
path: root/config_lava_network
blob: 415061aa6b55652caae3727934c1e0fac71a32b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh

lava_mac="x"

eth_from_mac()
{
        eth=`ifconfig -a | grep $1 | cut -d " " -f1`
        echo ${eth}
}

config()
{
        echo "attempting to bring up $1"
        cat /etc/network/interfaces | grep -v $1 > /tmp/interfaces
        cat /tmp/interfaces > /etc/network/interfaces
        echo "auto $1" >> /etc/network/interfaces
        echo "iface $1 inet dhcp" >> /etc/network/interfaces
}


for x in `cat /proc/cmdline`
do
        if [ `echo ${x} | grep -c lava_mac` -gt 0 ]
        then
                lava_mac=$(echo ${x} | cut -d= -f2)
        fi
done

if [ "${lava_mac}" != "x" ]
then
        echo "Found a LAVA MAC in kernel cmdline: ${lava_mac}"
        eth=`eth_from_mac ${lava_mac}`
        config ${eth}
else
        echo "No LAVA Mac found, bringing up eth0 as a guess"
        config eth0
fi