]>
git.ipfire.org Git - people/mfischer/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_exoscale
; then
15 scriptname
="/etc/rc.d/helper/exoscale-setup"
16 elif running_on_azure
; then
17 scriptname
="/etc/rc.d/helper/azure-setup"
18 elif running_on_gcp
; then
19 scriptname
="/etc/rc.d/helper/gcp-setup"
20 elif running_on_oci
; then
21 scriptname
="/etc/rc.d/helper/oci-setup"
23 # This system is not running in the cloud
27 # Find the first interface to use
28 for i
in /sys
/class
/net
/red
* /sys
/class
/net
/eth
* \
30 [ -d "${i}" ] ||
continue
34 [ "${i}" = "lo" ] && continue
36 # Use whatever we have found
41 # Check if we found a network interface
42 if [ ! -n "${intf}" ]; then
45 boot_mesg
-n "Could not find a network interface" ${FAILURE}
46 boot_mesg
"" ${NORMAL}
49 # Run a DHCP client and set up the system accordingly
50 dhclient
-sf "${scriptname}" "${intf}"
52 # End DHCP client immediately
53 dhclient
-sf "${scriptname}" -r "${intf}" &>/dev
/null
55 # Rename network devices
56 udevadm trigger
--action="add" --subsystem-match="net"
63 if running_on_ec2
; then
64 echo "This system is running on AWS EC2"
68 elif running_on_exoscale
; then
69 echo "This system is running on Exoscale"
73 elif running_on_azure
; then
74 echo "This system is running on Microsoft Azure"
78 elif running_on_gcp
; then
79 echo "This system is running on Google Cloud"
84 echo "This system is NOT running in the cloud"
90 echo "Usage: ${0} {start|status}"
95 # End $rc_base/init.d/cloud-init