. /etc/sysconfig/rc
. ${rc_functions}
-MD_URL="http://169.254.169.254/latest/meta-data"
-
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/identify_ec2_instances.html
running_on_ec2() {
local uuid
case "${1}" in
start)
# Do nothing if we are not running on AWS EC2
- running_on_ec2 || exit 0
-
- boot_mesg "Setting up system to run on AWS EC2..."
+ #running_on_ec2 || exit 0
# Find the first interface to use
for i in /sys/class/net/*; do
boot_mesg "" ${NORMAL}
fi
- # Assign ourselves an IP address to communicate with the meta-data service
- ip addr add 169.254.169.1/24 dev "${intf}"
- ip link set "${intf}" up
-
- # Initialise system settings
- if [ ! -s "/var/ipfire/main/settings" ]; then
- hostname=$(curl ${MD_URL}/local-hostname)
-
- (
- echo "HOSTNAME=${hostname%%.*}"
- echo "DOMAINNAME=${hostname#*.}"
- echo "THEME=ipfire"
- echo "LANGUAGE=en"
- echo "KEYMAP=/lib/kbd/keymaps/i386/qwerty/us.map.gz"
- echo "TIMEZONE=/usr/share/zoneinfo/posix/UTC"
- ) > /var/ipfire/main/settings
- fi
+ # Run a DHCP client and set up the system accordingly
+ dhclient -sf /etc/rc.d/helper/aws-setup "${intf}"
- # Remove any IP addresses
- ip addr flush dev "${intf}"
- echo_ok
+ # End DHCP client immediately
+ dhclient -sf /etc/rc.d/helper/aws-setup -r "${intf}"
- # This script has now completed the first steps of setup
- touch /var/ipfire/main/firstsetup_ok
+ # Trigger udev again to rename interfaces
+ udevadm trigger && udevadm settle
;;
status)