]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/initscripts/system/cloud-init
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
27 # Check if we are running in the cloud
28 if running_on_ec2
; then
29 scriptname
="/etc/rc.d/helper/aws-setup"
30 elif running_on_exoscale
; then
31 scriptname
="/etc/rc.d/helper/exoscale-setup"
32 elif running_on_azure
; then
33 scriptname
="/etc/rc.d/helper/azure-setup"
34 elif running_on_gcp
; then
35 scriptname
="/etc/rc.d/helper/gcp-setup"
36 elif running_on_oci
; then
37 scriptname
="/etc/rc.d/helper/oci-setup"
39 # This system is not running in the cloud
43 # Find the first interface to use
44 for i
in /sys
/class
/net
/red
* /sys
/class
/net
/eth
* \
46 [ -d "${i}" ] ||
continue
50 [ "${i}" = "lo" ] && continue
52 # Use whatever we have found
57 # Check if we found a network interface
58 if [ ! -n "${intf}" ]; then
61 boot_mesg
-n "Could not find a network interface" ${FAILURE}
62 boot_mesg
"" ${NORMAL}
65 # Run a DHCP client and set up the system accordingly
66 dhclient
-sf "${scriptname}" "${intf}"
68 # End DHCP client immediately
69 dhclient
-sf "${scriptname}" -r "${intf}" &>/dev
/null
71 # Rename network devices
72 udevadm trigger
--action="add" --subsystem-match="net"
79 if running_on_ec2
; then
80 echo "This system is running on AWS EC2"
84 elif running_on_exoscale
; then
85 echo "This system is running on Exoscale"
89 elif running_on_azure
; then
90 echo "This system is running on Microsoft Azure"
94 elif running_on_gcp
; then
95 echo "This system is running on Google Cloud"
100 echo "This system is NOT running in the cloud"
106 echo "Usage: ${0} {start|status}"