]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/initscripts/system/cloud-init
284e24d7b9fb4ac93ed95417fa51934faad6306c
2 ########################################################################
3 # Begin $rc_base/init.d/cloud-init
4 ########################################################################
11 # Check if we are running in the cloud
12 if running_on_ec2
; then
13 scriptname
="/etc/rc.d/helper/aws-setup"
14 elif running_on_azure
; then
15 scriptname
="/etc/rc.d/helper/azure-setup"
16 elif running_on_gcp
; then
17 scriptname
="/etc/rc.d/helper/gcp-setup"
19 # This system is not running in the cloud
23 # Find the first interface to use
24 for i
in /sys
/class
/net
/red
* /sys
/class
/net
/eth
* \
26 [ -d "${i}" ] ||
continue
30 [ "${i}" = "lo" ] && continue
32 # Use whatever we have found
37 # Check if we found a network interface
38 if [ ! -n "${intf}" ]; then
41 boot_mesg
-n "Could not find a network interface" ${FAILURE}
42 boot_mesg
"" ${NORMAL}
45 # Run a DHCP client and set up the system accordingly
46 dhclient
-sf "${scriptname}" "${intf}"
48 # End DHCP client immediately
49 dhclient
-sf "${scriptname}" -r "${intf}" &>/dev
/null
51 # Rename network devices
52 udevadm trigger
--action="add" --subsystem-match="net"
59 if running_on_ec2
; then
60 echo "This system is running on AWS EC2"
64 elif running_on_azure
; then
65 echo "This system is running on Microsoft Azure"
69 elif running_on_gcp
; then
70 echo "This system is running on Google Cloud"
75 echo "This system is NOT running in the cloud"
81 echo "Usage: ${0} {start|status}"
86 # End $rc_base/init.d/cloud-init