X-Git-Url: http://git.onelab.eu/?p=build.git;a=blobdiff_plain;f=lbuild-bridge.sh;h=d3b2ab7a68733a14f307512f0e1c8a1f095c584d;hp=6bf317ea2c8b380394a4f4af9666a8072f80a1e2;hb=HEAD;hpb=6421c6b5d11d7d0361c91c0402c554e3931940d3 diff --git a/lbuild-bridge.sh b/lbuild-bridge.sh index 6bf317ea..d3b2ab7a 100755 --- a/lbuild-bridge.sh +++ b/lbuild-bridge.sh @@ -1,35 +1,36 @@ #!/bin/bash -# taking this bridge-initialization code out of lbuild-initvm.sh -# so we can use it on our libvirt/lxc local infra -# there's something very similar in +# taking this bridge-initialization code out of lbuild-initvm.sh +# so we can use it on our libvirt/lxc local infra +# there's something very similar in # tests/system/template-qemu/qemu-bridge-init -# that the current code was actually based on, but -# nobody was ever bold enough to reconcile these two +# that the current code was actually based on, but +# nobody was ever bold enough to reconcile these two -# hard-wired +# hard-wired DEFAULT_PUBLIC_BRIDGE=br0 ############################## # use /proc/net/dev instead of a hard-wired list function gather_interfaces () { - python <& /dev/null && { - echo "Bridge already set up - skipping create_bridge_if_needed" - return 0 + echo "Bridge already set up - skipping create_bridge_if_needed" + return 0 } # find out the physical interface to bridge onto @@ -87,7 +88,7 @@ function create_bridge_if_needed() { sysctl net.bridge.bridge-nf-call-ip6tables=0 sysctl net.bridge.bridge-nf-call-arptables=0 - + #Getting host IP/masklen address=$(ip addr show $if_lan | grep -v inet6 | grep inet | head --lines=1 | awk '{print $2;}') [ -z "$address" ] && { echo "ERROR: Could not determine IP address for $if_lan" ; exit 1 ; } @@ -106,7 +107,7 @@ function create_bridge_if_needed() { echo "Activating promiscuous mode if_lan=$if_lan" ip link set $if_lan up promisc on sleep 2 - # rely on dhcp to re assign IP.. + # rely on dhcp to re assign IP.. echo "Starting dhclient on $public_bridge" dhclient $public_bridge sleep 1 @@ -136,10 +137,10 @@ function create_bridge_if_needed() { } function main () { - if [[ -n "$@" ]] ; then - public_bridge="$1"; shift + if [[ -n "$@" ]] ; then + public_bridge="$1"; shift else - public_bridge="$DEFAULT_PUBLIC_BRIDGE" + public_bridge="$DEFAULT_PUBLIC_BRIDGE" fi create_bridge_if_needed $public_bridge }