]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/initscripts/system/aws
2 ########################################################################
3 # Begin $rc_base/init.d/aws
4 ########################################################################
9 # https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/identify_ec2_instances.html
13 # Check if the hypervisor UUID starts with ec2
14 if [ -r "/sys/hypervisor/uuid" ]; then
15 uuid
=$
(</sys
/hypervisor
/uuid
)
17 [ "${uuid:0:3}" = "ec2" ] && return 0
20 # Check if the DMI product UUID starts with EC2
21 if [ -r "/sys/devices/virtual/dmi/id/product_uuid" ]; then
22 uuid
=$
(</sys
/devices
/virtual
/dmi
/id
/product_uuid
)
24 [ "${uuid:0:3}" = "EC2" ] && return 0
27 # We are not running on AWS EC2
33 # Do nothing if we are not running on AWS EC2
34 #running_on_ec2 || exit 0
36 # Find the first interface to use
37 for i
in /sys
/class
/net
/*; do
38 [ -d "${i}" ] ||
continue
42 [ "${i}" = "lo" ] && continue
44 # Use whatever we have found
49 # Check if we found a network interface
50 if [ ! -n "${intf}" ]; then
53 boot_mesg
-n "Could not find a network interface" ${FAILURE}
54 boot_mesg
"" ${NORMAL}
57 # Run a DHCP client and set up the system accordingly
58 dhclient
-sf /etc
/rc.d
/helper
/aws-setup
"${intf}"
60 # End DHCP client immediately
61 dhclient
-sf /etc
/rc.d
/helper
/aws-setup
-r "${intf}"
65 if running_on_ec2
; then
66 echo "This system is running on AWS EC2"
69 echo "This system is NOT running on AWS EC2"
75 echo "Usage: ${0} {start|status}"
80 # End $rc_base/init.d/aws