~ubuntu-branches/ubuntu/natty/eucalyptus/natty

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
# eucalyptus-network - emit a signal when the network is really ready

description    "Eucalyptus network readiness"
author "Dustin Kirkland <kirkland@canonical.com>"

start on net-device-up
task
env IFACE=manual-start
instance $IFACE
emits eucalyptus-network-is-ready

script
	default_route=$(ip route show to exact 0/0)
	if [ -z "$default_route" ]; then
		stop
		exit 0
	fi
	conf="/etc/eucalyptus/eucalyptus-ipaddr.conf"
	if [ ! -e "$conf" ]; then
		default_interface=$(echo $default_route | sed -e 's/^.*dev \([^ ]*\).*$/\1/')
		addr_withprefix=$(ip addr show label $default_interface scope global | awk '$1 == "inet" { print $2 }')
		addr=${addr_withprefix%%/*}
		[ -f "/usr/share/eucalyptus/eucalyptus-cloud-2.0.2.jar" ]  && echo CLOUD_IP_ADDR="$addr" >> "$conf"
		[ -f "/usr/share/eucalyptus/eucalyptus-walrus-2.0.2.jar" ] && echo WALRUS_IP_ADDR="$addr" >> "$conf"
		[ -f "/usr/lib/axis2/services/EucalyptusCC/libEucalyptusCC.so" ] && echo CC_IP_ADDR="$addr" >> "$conf"
		[ -f "/usr/share/eucalyptus/eucalyptus-storagecontroller-2.0.2.jar" ] && echo SC_IP_ADDR="$addr" >> "$conf"
	fi
	initctl emit eucalyptus-network-is-ready
end script