]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/initscripts/system/aws
AWS: Import aws setup script
[people/pmueller/ipfire-2.x.git] / src / initscripts / system / aws
index a61834b61099c4470d0313f1bbadf77962408c2e..1810f3372ee877d99008fb73e9ceac516be0ecd9 100644 (file)
@@ -6,8 +6,6 @@
 . /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
@@ -33,9 +31,7 @@ running_on_ec2() {
 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
@@ -58,30 +54,14 @@ case "${1}" in
                        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)