#!/bin/bash # # genome-bridge: Network bridge for Genome virtualization # # chkconfig: - 15 80 # # description: Network bridge for Genome virtualization. # # # # Source function library. . /etc/init.d/functions BRIDGE="genomebr0" case "$1" in start) echo -n $"Starting genome-bridge: " touch /var/lock/subsys/genome-bridge /usr/bin/pkill -f "dhclient eth0" /usr/bin/pkill -f "dhclient $BRIDGE" /usr/sbin/brctl addbr $BRIDGE /sbin/ifconfig eth0 0.0.0.0 promisc up /usr/sbin/brctl addif $BRIDGE eth0 #TODO: support more than eth0 /sbin/dhclient $BRIDGE #TODO: support static IPs RETVAL=$? ;; stop) echo -n $"Stopping genome-bridge: " /sbin/ifconfig $BRIDGE down /sbin/service network restart /usr/sbin/brctl delbr $BRIDGE RETVAL=$? rm -rf /var/lock/subsys/genome-bridge ;; restart|reload) $0 stop $0 start ;; status) /sbin/ifconfig $BRIDGE &> /dev/null RETVAL=$? if [ $RETVAL == 0 ]; then echo "Bridge is up" else echo "Bridge is down" fi exit $RETVAL ;; *) echo $"Usage: $0 {start|stop|status|restart|reload}" RETVAL=1 esac exit $RETVAL