]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/initscripts/system/cloud-init
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"
18 elif running_on_oci
; then
19 scriptname
="/etc/rc.d/helper/oci-setup"
21 # This system is not running in the cloud
25 # Find the first interface to use
26 for i
in /sys
/class
/net
/red
* /sys
/class
/net
/eth
* \
28 [ -d "${i}" ] ||
continue
32 [ "${i}" = "lo" ] && continue
34 # Use whatever we have found
39 # Check if we found a network interface
40 if [ ! -n "${intf}" ]; then
43 boot_mesg
-n "Could not find a network interface" ${FAILURE}
44 boot_mesg
"" ${NORMAL}
47 # Run a DHCP client and set up the system accordingly
48 dhclient
-sf "${scriptname}" "${intf}"
50 # End DHCP client immediately
51 dhclient
-sf "${scriptname}" -r "${intf}" &>/dev
/null
53 # Rename network devices
54 udevadm trigger
--action="add" --subsystem-match="net"
61 if running_on_ec2
; then
62 echo "This system is running on AWS EC2"
66 elif running_on_azure
; then
67 echo "This system is running on Microsoft Azure"
71 elif running_on_gcp
; then
72 echo "This system is running on Google Cloud"
77 echo "This system is NOT running in the cloud"
83 echo "Usage: ${0} {start|status}"
88 # End $rc_base/init.d/cloud-init