]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
cloud-init: Execute setup script for Azure if needed
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 14 Jun 2019 15:42:09 +0000 (15:42 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 1 Jul 2019 06:53:58 +0000 (07:53 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/initscripts/system/cloud-init

index 4bd474b0baba785dd26d2c8cac0ae1ab40de519d..f385ce5d19916e5e606cd319644f4f9147b99988 100644 (file)
@@ -46,8 +46,15 @@ running_on_azure() {
 
 case "${1}" in
        start)
-               # Do nothing if we are not running on AWS EC2
-               running_on_ec2 || exit 0
+               # Check if we are running in the cloud
+               if running_on_ec2; then
+                       scriptname="/etc/rc.d/helper/aws-setup"
+               elif running_on_azure; then
+                       scriptname="/etc/rc.d/helper/azure-setup"
+               else
+                       # This system is not running in the cloud
+                       exit 0
+               fi
 
                # Find the first interface to use
                for i in /sys/class/net/red* /sys/class/net/eth* \
@@ -72,10 +79,10 @@ case "${1}" in
                fi
 
                # Run a DHCP client and set up the system accordingly
-               dhclient -sf /etc/rc.d/helper/aws-setup "${intf}"
+               dhclient -sf "${scriptname}" "${intf}"
 
                # End DHCP client immediately
-               dhclient -sf /etc/rc.d/helper/aws-setup -r "${intf}" &>/dev/null
+               dhclient -sf "${scriptname}" -r "${intf}" &>/dev/null
 
                # Rename network devices
                udevadm trigger --action="add" --subsystem-match="net"